OSDN Git Service

Flush addPersistentPreferredActivity setting in DPMS
authorTony Mak <tonymak@google.com>
Mon, 13 Feb 2017 17:08:35 +0000 (17:08 +0000)
committerTony Mak <tonymak@google.com>
Tue, 14 Feb 2017 18:18:48 +0000 (18:18 +0000)
To fix the glitch that "kiosk mode" does not persist if device
is rebooted within 10s after addPersistentPreferredActivity is called.

Test: Manual Test
      1. Using TestDPC to start kisok mode, reboot right away.
      Observed that TestDPC is launched in kiosk mode.
      2. Stop the kiosk mode, reboot without 10s.
         Kisok mode is stopped.

Fix: 28169791

Change-Id: I555fc18efe86380f2e028b698c2bdb01017bf9f5

services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java

index 22dd9d7..b72293c 100644 (file)
@@ -7271,6 +7271,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
             long id = mInjector.binderClearCallingIdentity();
             try {
                 mIPackageManager.addPersistentPreferredActivity(filter, activity, userHandle);
+                mIPackageManager.flushPackageRestrictionsAsUser(userHandle);
             } catch (RemoteException re) {
                 // Shouldn't happen
             } finally {
@@ -7289,6 +7290,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
             long id = mInjector.binderClearCallingIdentity();
             try {
                 mIPackageManager.clearPackagePersistentPreferredActivities(packageName, userHandle);
+                mIPackageManager.flushPackageRestrictionsAsUser(userHandle);
             } catch (RemoteException re) {
                 // Shouldn't happen
             } finally {