From 37887b2d4c29c95253bd49890ef86f642ca83195 Mon Sep 17 00:00:00 2001 From: Carmen Jackson Date: Wed, 5 Feb 2020 21:55:00 -0800 Subject: [PATCH] Fix PinnerService SecurityException at boot We were passing "system" as the callingPackage argument when calling registerUidObserver, which is apparently invalid. null is a valid option here and seems to pin everything as expected, so this change updates this call to avoid the SecurityException. Note that this SecurityException does not seem to have affected the actual pinning of the expected files - we still pin the same files before and after this change. Bug: 147355976 Test: No longer see the SecurityException at boot. Running dumpsys pinner at boot shows that the same files are pinned as before this change, including the Camera app but not including a Launcher app. After using the four-corner tap to bypass the setup wizard, the Launcher app is pinned. This indicates that the uid observer worked correctly to re-pin the Launcher app after it replaces the setup wizard. Change-Id: I2cd845cb5fad3de251d110141dcd1af9ec3aa234 Merged-In: I2cd845cb5fad3de251d110141dcd1af9ec3aa234 (cherry picked from commit 96f6b2d1d9381f0adad684ca29a559cbed948536) --- services/core/java/com/android/server/PinnerService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/PinnerService.java b/services/core/java/com/android/server/PinnerService.java index 93859b35fbe09..3148a62058713 100644 --- a/services/core/java/com/android/server/PinnerService.java +++ b/services/core/java/com/android/server/PinnerService.java @@ -345,7 +345,7 @@ public final class PinnerService extends SystemService { @Override public void onUidCachedChanged(int uid, boolean cached) throws RemoteException { } - }, UID_OBSERVER_GONE | UID_OBSERVER_ACTIVE, 0, "system"); + }, UID_OBSERVER_GONE | UID_OBSERVER_ACTIVE, 0, null); } catch (RemoteException e) { Slog.e(TAG, "Failed to register uid observer", e); }