Merge "Remove cameraserver from car products" into rvc-qpr-dev
diff --git a/service/src/com/android/car/am/FixedActivityService.java b/service/src/com/android/car/am/FixedActivityService.java
index 5e5454b..81bc470 100644
--- a/service/src/com/android/car/am/FixedActivityService.java
+++ b/service/src/com/android/car/am/FixedActivityService.java
@@ -153,8 +153,9 @@
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (Intent.ACTION_PACKAGE_CHANGED.equals(action)
- || Intent.ACTION_PACKAGE_REPLACED.equals(
- action)) {
+ || Intent.ACTION_PACKAGE_REPLACED.equals(action)
+ || Intent.ACTION_PACKAGE_ADDED.equals(action)
+ || Intent.ACTION_PACKAGE_REMOVED.equals(action)) {
Uri packageData = intent.getData();
if (packageData == null) {
Log.w(TAG_AM, "null packageData");
@@ -171,15 +172,15 @@
synchronized (mLock) {
for (int i = 0; i < mRunningActivities.size(); i++) {
RunningActivityInfo info = mRunningActivities.valueAt(i);
- ComponentName component = info.intent.getComponent();
- // should do this for all activities as the same package can cover multiple
- // displays.
- if (packageName.equals(component.getPackageName())
- && info.userId == userId) {
- Log.i(TAG_AM, "Package updated:" + packageName
- + ",user:" + userId);
+ // Should do this for all activities as it can happen for multiple
+ // displays. Package name is ignored as one package can affect
+ // others.
+ if (info.userId == userId) {
+ Log.i(TAG_AM, "Package changed:" + packageName
+ + ",user:" + userId + ",action:" + action);
info.resetCrashCounterLocked();
tryLaunch = true;
+ break;
}
}
}
@@ -384,6 +385,8 @@
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
filter.addAction(Intent.ACTION_PACKAGE_REPLACED);
+ filter.addAction(Intent.ACTION_PACKAGE_ADDED);
+ filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
filter.addDataScheme("package");
mContext.registerReceiverAsUser(mBroadcastReceiver, UserHandle.ALL, filter,
/* broadcastPermission= */ null, /* scheduler= */ null);
diff --git a/tests/carservice_unit_test/src/com/android/car/am/FixedActivityServiceTest.java b/tests/carservice_unit_test/src/com/android/car/am/FixedActivityServiceTest.java
index 9432cae..c3f57ad 100644
--- a/tests/carservice_unit_test/src/com/android/car/am/FixedActivityServiceTest.java
+++ b/tests/carservice_unit_test/src/com/android/car/am/FixedActivityServiceTest.java
@@ -223,7 +223,7 @@
int appId = 987;
BroadcastReceiver receiver = receiverCaptor.getValue();
Intent packageIntent = new Intent(Intent.ACTION_PACKAGE_CHANGED);
- packageIntent.setData(new Uri.Builder().path(packageName).build());
+ packageIntent.setData(new Uri.Builder().path("Any package").build());
packageIntent.putExtra(Intent.EXTRA_UID, UserHandle.getUid(userId, appId));
receiver.onReceive(mContext, packageIntent);
verify(mContext).startActivityAsUser(eq(intent), any(Bundle.class),