Remove package name from ROLLBACK_EXECUTED broadcast.
The receiver of the broadcast would likely want to query the rolled back packages via RollbackManager regardless, and it's not clear which package to put when an atomic set of packages is rolled back. Bug: 112431924 Test: atest RollbackTest Change-Id: Ic8db00b62d8993e00a0dd2cb79ae68c430b45bb8
This commit is contained in:
@@ -2363,7 +2363,6 @@ public class Intent implements Parcelable, Cloneable {
|
||||
/**
|
||||
* Broadcast Action: An existing version of an application package has been
|
||||
* rolled back to a previous version.
|
||||
* The data contains the name of the package.
|
||||
*
|
||||
* <p class="note">This is a protected intent that can only be sent
|
||||
* by the system.
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.server.rollback;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.AppOpsManager;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
@@ -36,7 +35,6 @@ import android.content.pm.VersionedPackage;
|
||||
import android.content.rollback.IRollbackManager;
|
||||
import android.content.rollback.PackageRollbackInfo;
|
||||
import android.content.rollback.RollbackInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Binder;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
@@ -384,12 +382,12 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub {
|
||||
addRecentlyExecutedRollback(rollback);
|
||||
sendSuccess(statusReceiver);
|
||||
|
||||
Intent broadcast = new Intent(Intent.ACTION_PACKAGE_ROLLBACK_EXECUTED,
|
||||
Uri.fromParts("package", targetPackageName,
|
||||
Manifest.permission.MANAGE_ROLLBACKS));
|
||||
Intent broadcast = new Intent(Intent.ACTION_PACKAGE_ROLLBACK_EXECUTED);
|
||||
|
||||
// TODO: This call emits the warning "Calling a method in the
|
||||
// system process without a qualified user". Fix that.
|
||||
// TODO: Limit this to receivers holding the
|
||||
// MANAGE_ROLLBACKS permission?
|
||||
mContext.sendBroadcast(broadcast);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -44,7 +44,6 @@ class RollbackBroadcastReceiver extends BroadcastReceiver {
|
||||
RollbackBroadcastReceiver() {
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(Intent.ACTION_PACKAGE_ROLLBACK_EXECUTED);
|
||||
filter.addDataScheme("package");
|
||||
InstrumentationRegistry.getContext().registerReceiver(this, filter);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ import android.content.IntentFilter;
|
||||
import android.content.rollback.PackageRollbackInfo;
|
||||
import android.content.rollback.RollbackInfo;
|
||||
import android.content.rollback.RollbackManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerThread;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
@@ -152,7 +151,6 @@ public class RollbackTest {
|
||||
// received could lead to test flakiness.
|
||||
Intent broadcast = broadcastReceiver.poll(5, TimeUnit.SECONDS);
|
||||
assertNotNull(broadcast);
|
||||
assertEquals(TEST_APP_A, broadcast.getData().getSchemeSpecificPart());
|
||||
assertNull(broadcastReceiver.poll(0, TimeUnit.SECONDS));
|
||||
|
||||
// Verify the recent rollback has been recorded.
|
||||
@@ -474,8 +472,7 @@ public class RollbackTest {
|
||||
@Test
|
||||
public void testRollbackBroadcastRestrictions() throws Exception {
|
||||
RollbackBroadcastReceiver broadcastReceiver = new RollbackBroadcastReceiver();
|
||||
Intent broadcast = new Intent(Intent.ACTION_PACKAGE_ROLLBACK_EXECUTED,
|
||||
Uri.fromParts("package", "com.android.tests.rollback.bogus", null));
|
||||
Intent broadcast = new Intent(Intent.ACTION_PACKAGE_ROLLBACK_EXECUTED);
|
||||
try {
|
||||
InstrumentationRegistry.getContext().sendBroadcast(broadcast);
|
||||
fail("Succeeded in sending restricted broadcast from app context.");
|
||||
|
||||
Reference in New Issue
Block a user