diff options
| author | 2019-07-15 17:52:55 +0000 | |
|---|---|---|
| committer | 2019-07-15 17:52:55 +0000 | |
| commit | cee1542bfec531c18ce7b9f60159091df8569174 (patch) | |
| tree | 4f3475718df7c328c2231f0b1680efbca0f575a7 | |
| parent | 5f06dfc19360d7e52c056954a210155e359c852a (diff) | |
| parent | 6e5ba33f973498a86136f7d7bd2c9ba5dad95c0d (diff) | |
Merge cherrypicks of [8655472, 8655254, 8655915, 8655916, 8655554, 8655935, 8655917, 8655800, 8655789, 8655473, 8655918, 8655474, 8655408, 8655351] into qt-release
Change-Id: I32aeb291cf1eba478b705239a6d704a852a128d6
| -rw-r--r-- | services/core/java/com/android/server/UiModeManagerService.java | 10 | ||||
| -rw-r--r-- | services/core/java/com/android/server/policy/PermissionPolicyService.java | 21 |
2 files changed, 18 insertions, 13 deletions
diff --git a/services/core/java/com/android/server/UiModeManagerService.java b/services/core/java/com/android/server/UiModeManagerService.java index bc7da3fe2edc..30a356325ada 100644 --- a/services/core/java/com/android/server/UiModeManagerService.java +++ b/services/core/java/com/android/server/UiModeManagerService.java @@ -413,15 +413,15 @@ final class UiModeManagerService extends SystemService { try { synchronized (mLock) { if (mNightMode != mode) { - if (UserManager.get(getContext()).isPrimaryUser()) { - SystemProperties.set(SYSTEM_PROPERTY_DEVICE_THEME, - Integer.toString(mode)); - } - // Only persist setting if not in car mode if (!mCarModeEnabled) { Secure.putIntForUser(getContext().getContentResolver(), Secure.UI_NIGHT_MODE, mode, user); + + if (UserManager.get(getContext()).isPrimaryUser()) { + SystemProperties.set(SYSTEM_PROPERTY_DEVICE_THEME, + Integer.toString(mode)); + } } mNightMode = mode; diff --git a/services/core/java/com/android/server/policy/PermissionPolicyService.java b/services/core/java/com/android/server/policy/PermissionPolicyService.java index 037293f9536c..a569bffef141 100644 --- a/services/core/java/com/android/server/policy/PermissionPolicyService.java +++ b/services/core/java/com/android/server/policy/PermissionPolicyService.java @@ -798,7 +798,7 @@ public final class PermissionPolicyService extends SystemService { @Override public boolean checkStartActivity(@NonNull Intent intent, int callingUid, @Nullable String callingPackage) { - if (callingPackage != null && isActionRemovedForCallingPackage(intent.getAction(), + if (callingPackage != null && isActionRemovedForCallingPackage(intent, callingUid, callingPackage)) { Slog.w(LOG_TAG, "Action Removed: starting " + intent.toString() + " from " + callingPackage + " (uid=" + callingUid + ")"); @@ -811,8 +811,9 @@ public final class PermissionPolicyService extends SystemService { * Check if the intent action is removed for the calling package (often based on target SDK * version). If the action is removed, we'll silently cancel the activity launch. */ - private boolean isActionRemovedForCallingPackage(@Nullable String action, + private boolean isActionRemovedForCallingPackage(@NonNull Intent intent, int callingUid, @NonNull String callingPackage) { + String action = intent.getAction(); if (action == null) { return false; } @@ -821,15 +822,19 @@ public final class PermissionPolicyService extends SystemService { case Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT: { ApplicationInfo applicationInfo; try { - applicationInfo = getContext().getPackageManager().getApplicationInfo( - callingPackage, 0); + applicationInfo = getContext().getPackageManager().getApplicationInfoAsUser( + callingPackage, 0, UserHandle.getUserId(callingUid)); + if (applicationInfo.targetSdkVersion >= Build.VERSION_CODES.Q) { + // Applications targeting Q or higher should use + // RoleManager.createRequestRoleIntent() instead. + return true; + } } catch (PackageManager.NameNotFoundException e) { Slog.i(LOG_TAG, "Cannot find application info for " + callingPackage); - return false; } - // Applications targeting Q should use RoleManager.createRequestRoleIntent() - // instead. - return applicationInfo.targetSdkVersion >= Build.VERSION_CODES.Q; + // Make sure RequestRoleActivity can know the calling package if we allow it. + intent.putExtra(Intent.EXTRA_CALLING_PACKAGE, callingPackage); + return false; } default: return false; |