Merge "Fix screen capture in car bugreport tool." into qt-dev
diff --git a/service/src/com/android/car/pm/CarPackageManagerService.java b/service/src/com/android/car/pm/CarPackageManagerService.java
index 92e92a8..d00c7f1 100644
--- a/service/src/com/android/car/pm/CarPackageManagerService.java
+++ b/service/src/com/android/car/pm/CarPackageManagerService.java
@@ -69,6 +69,8 @@
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
+import com.google.android.collect.Sets;
+
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
@@ -133,13 +135,11 @@
// Information related to when the installed packages should be parsed for building a white and
// black list
- private final List<String> mPackageManagerActions = Arrays.asList(
+ private final Set<String> mPackageManagerActions = Sets.newArraySet(
Intent.ACTION_PACKAGE_ADDED,
Intent.ACTION_PACKAGE_CHANGED,
- Intent.ACTION_PACKAGE_DATA_CLEARED,
Intent.ACTION_PACKAGE_REMOVED,
- Intent.ACTION_PACKAGE_REPLACED,
- Intent.ACTION_PACKAGE_FULLY_REMOVED);
+ Intent.ACTION_PACKAGE_REPLACED);
private final PackageParsingEventReceiver mPackageParsingEventReceiver =
new PackageParsingEventReceiver();
@@ -179,6 +179,7 @@
/**
* int display id of the blocked task.
+ *
* @hide
*/
public static final String BLOCKING_INTENT_EXTRA_DISPLAY_ID = "display_id";
@@ -657,9 +658,9 @@
* - whitelist from resource config;
* - activity declared as Distraction Optimized (D.O.) in manifest;
* - blacklist from resource config - package/activity blacklisted will not exist
- * in returned whitelist.
+ * in returned whitelist.
*
- * @param userId Parse packages installed for user.
+ * @param userId Parse packages installed for user.
* @param configWhitelist Whitelist from config.
* @param configBlacklist Blacklist from config.
*/
@@ -941,7 +942,7 @@
private String dumpPoliciesLocked(boolean dumpAll) {
StringBuilder sb = new StringBuilder();
if (dumpAll) {
- sb.append("**System white list**\n");
+ sb.append("**System whitelist**\n");
for (AppBlockingPackageInfoWrapper wrapper : mActivityWhitelistMap.values()) {
sb.append(wrapper.toString() + "\n");
}
@@ -1091,10 +1092,9 @@
* Creates an intent to start blocking activity.
*
* @param blockingActivity the activity to launch
- * @param blockedActivity the activity being blocked
- * @param blockedTaskId the blocked task id, which contains the blocked activity
+ * @param blockedActivity the activity being blocked
+ * @param blockedTaskId the blocked task id, which contains the blocked activity
* @param taskRootActivity root activity of the blocked task
- *
* @return an intent to launch the blocking activity.
*/
private static Intent createBlockingActivityIntent(ComponentName blockingActivity,
@@ -1121,7 +1121,6 @@
* Enable/Disable activity blocking by correspondingly enabling/disabling broadcasting UXR
* changes in {@link CarUxRestrictionsManagerService}. This is only available in
* engineering builds for development convenience.
- *
*/
@Override
public synchronized void setEnableActivityBlocking(boolean enable) {
@@ -1451,7 +1450,7 @@
}
private boolean isPackageManagerAction(String action) {
- return mPackageManagerActions.indexOf(action) != -1;
+ return mPackageManagerActions.contains(action);
}
/**
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/KitchenSinkActivity.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/KitchenSinkActivity.java
index 70949a9..1448ede 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/KitchenSinkActivity.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/KitchenSinkActivity.java
@@ -77,9 +77,12 @@
public class KitchenSinkActivity extends FragmentActivity {
private static final String TAG = "KitchenSinkActivity";
+ private static final String LAST_FRAGMENT_TAG = "lastFragmentTag";
+ private static final String DEFAULT_FRAGMENT_TAG = "";
private RecyclerView mMenu;
private Button mMenuButton;
private View mKitchenContent;
+ private String mLastFragmentTag = DEFAULT_FRAGMENT_TAG;
private interface ClickHandler {
void onClick();
@@ -150,6 +153,7 @@
if (fragment != null) {
KitchenSinkActivity.this.showFragment(fragment);
toggleMenuVisibility();
+ mLastFragmentTag = fragment.getTag();
} else {
Log.e(TAG, "cannot show fragment for " + getText());
}
@@ -254,6 +258,21 @@
onNewIntent(getIntent());
}
+ @Override
+ protected void onRestoreInstanceState(Bundle savedInstanceState) {
+ super.onRestoreInstanceState(savedInstanceState);
+ // The app is being started for the first time.
+ if (savedInstanceState == null) {
+ return;
+ }
+
+ // The app is being reloaded, restores the last fragment UI.
+ mLastFragmentTag = savedInstanceState.getString(LAST_FRAGMENT_TAG);
+ if (mLastFragmentTag != DEFAULT_FRAGMENT_TAG) {
+ toggleMenuVisibility();
+ }
+ }
+
private void toggleMenuVisibility() {
boolean menuVisible = mMenu.getVisibility() == View.VISIBLE;
mMenu.setVisibility(menuVisible ? View.GONE : View.VISIBLE);
@@ -289,6 +308,12 @@
}
@Override
+ protected void onSaveInstanceState(Bundle outState) {
+ outState.putString(LAST_FRAGMENT_TAG, mLastFragmentTag);
+ super.onSaveInstanceState(outState);
+ }
+
+ @Override
protected void onPause() {
super.onPause();
Log.i(TAG, "onPause");