Make the tests permissive for Q
the releated to playstore step in CTS-verifier#Instant Apps Notification Test should skip in china version
Test: m -j32 CtsVerifier
m -j32 CtsVerifierInstantApp
adb install -r -g CtsVerifier.apk
adb install -r --instant CtsVerifierInstantApp.apk
Launch CtsVerifier, Instant Apps Notification Test and see its notification
(cherry picked from commit c5355fdb748acb8bbca5ddd0e9445cbc5e1e1824)
Bug:137256600
Change-Id: I0ec6ca0ce31f4c0df499561486d4774e8c56ff15
diff --git a/apps/CtsVerifier/res/values/strings.xml b/apps/CtsVerifier/res/values/strings.xml
index 8a6c1d7..86efbde 100755
--- a/apps/CtsVerifier/res/values/strings.xml
+++ b/apps/CtsVerifier/res/values/strings.xml
@@ -5090,9 +5090,16 @@
1. Click Start Test. \n\n
2. An alert dialog with install instruction will be shown if the sample Instant App has not been installed, otherwise, the sample Instant App will be opened automatically. \n\n
3. Drag down the notification bar when the sample Instant App is at foreground. \n\n
+ 4. Skip this step in china version. \n\n
+ 5. Click Pass button if all checks in step 4 passed, otherwise click Fail button.
+ </string>
+ <string name="ia_notification_instruction_label_no_app_market_version">\n
+ 1. Click Start Test. \n\n
+ 2. An alert dialog with install instruction will be shown if the sample Instant App has not been installed, otherwise, the sample Instant App will be opened automatically. \n\n
+ 3. Drag down the notification bar when the sample Instant App is at foreground. \n\n
4. Check if Instant App is shown in notification area with the following (Please expand the notification if it is collapsed): \n
\u0020\u0020\u0020a. It provides information about Instant Apps not requiring installation and an action that provides more information about the Instant App. \n
- \u0020\u0020\u0020b. It provides an action allowing the user to launch the associated link with web browser. \n\n
+ \u0020\u0020\u0020b. Skip this step in china version.Can not launch the associated link with web browser. \n\n
5. Click Pass button if all checks in step 4 passed, otherwise click Fail button.
</string>
<string name="ia_recents">Instant Apps Recents Test</string>
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/instantapps/NotificationTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/instantapps/NotificationTestActivity.java
old mode 100644
new mode 100755
index 6e2052c..77caeb9
--- a/apps/CtsVerifier/src/com/android/cts/verifier/instantapps/NotificationTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/instantapps/NotificationTestActivity.java
@@ -16,6 +16,8 @@
package com.android.cts.verifier.instantapps;
import android.os.Bundle;
+import android.os.SystemProperties;
+import android.content.pm.PackageManager;
import android.widget.TextView;
import com.android.cts.verifier.R;
@@ -34,6 +36,18 @@
setInfoResources(R.string.ia_notification, R.string.ia_notification_info, -1);
TextView extraText = (TextView) findViewById(R.id.instruction_extra_text);
- extraText.setText(R.string.ia_notification_instruction_label);
+ if (isNoGooglePlayStore()) {
+ extraText.setText(R.string.ia_notification_instruction_label_no_app_market_version);
+ } else {
+ extraText.setText(R.string.ia_notification_instruction_label);
+ }
+ }
+
+ private boolean isNoGooglePlayStore() {
+ boolean isCnGmsVersion =
+ getApplicationContext().getPackageManager().hasSystemFeature("cn.google.services");
+ boolean isNoGmsVersion =
+ (SystemProperties.get("ro.com.google.gmsversion", null) == null);
+ return isCnGmsVersion || isNoGmsVersion;
}
}