diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-08-20 00:34:34 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-08-20 00:34:34 +0000 |
commit | 550ec2c875bb8557f13f7b31f9d5fd175195e194 (patch) | |
tree | ecde5dec2b37ad6ecf3088a6ffe2104a96c4a4d1 | |
parent | 90caa97251572853527afd4779562f847b5a656d (diff) | |
parent | 5699b6072426dbf668cb8c6d2d695f1412734b5d (diff) | |
download | base-550ec2c875bb8557f13f7b31f9d5fd175195e194.tar.gz |
Merge cherrypicks of [15633344, 15633345, 15633457, 15633423, 15633424, 15633425, 15633095, 15633401, 15632569, 15633426, 15633427, 15633402, 15633346, 15633347, 15633403, 15633458] into sc-release
Change-Id: If324c46091cedb24582f468faa6e57447877ca0d
6 files changed, 96 insertions, 77 deletions
diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml index 55ed83b32262..b191584345ef 100644 --- a/core/res/res/values/colors.xml +++ b/core/res/res/values/colors.xml @@ -248,37 +248,37 @@ <color name="system_accent1_0">#ffffff</color> <!-- Shade of the accent system color at 99% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent1_10">#F1FFFC</color> + <color name="system_accent1_10">#F9FCFF</color> <!-- Shade of the accent system color at 95% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent1_50">#9CFFF2</color> + <color name="system_accent1_50">#E0F3FF</color> <!-- Shade of the accent system color at 90% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent1_100">#8DF5E3</color> + <color name="system_accent1_100">#C1E8FF</color> <!-- Shade of the accent system color at 80% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent1_200">#71D8C7</color> + <color name="system_accent1_200">#76D1FF</color> <!-- Shade of the accent system color at 70% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent1_300">#53BCAC</color> + <color name="system_accent1_300">#4BB6E8</color> <!-- Shade of the accent system color at 60% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent1_400">#34A192</color> + <color name="system_accent1_400">#219BCC</color> <!-- Shade of the accent system color at 49% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent1_500">#008375</color> + <color name="system_accent1_500">#007FAC</color> <!-- Shade of the accent system color at 40% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent1_600">#006C5F</color> + <color name="system_accent1_600">#00668B</color> <!-- Shade of the accent system color at 30% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent1_700">#005747</color> + <color name="system_accent1_700">#004C69</color> <!-- Shade of the accent system color at 20% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent1_800">#003E31</color> + <color name="system_accent1_800">#003549</color> <!-- Shade of the accent system color at 10% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent1_900">#002214</color> + <color name="system_accent1_900">#001E2C</color> <!-- Darkest shade of the accent color used by the system. Black. This value can be overlaid at runtime by OverlayManager RROs. --> <color name="system_accent1_1000">#000000</color> @@ -288,37 +288,37 @@ <color name="system_accent2_0">#ffffff</color> <!-- Shade of the secondary accent system color at 99% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent2_10">#F0FFFC</color> + <color name="system_accent2_10">#F9FCFF</color> <!-- Shade of the secondary accent system color at 95% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent2_50">#CDFAF1</color> + <color name="system_accent2_50">#E0F3FF</color> <!-- Shade of the secondary accent system color at 90% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent2_100">#BFEBE3</color> + <color name="system_accent2_100">#D1E5F4</color> <!-- Shade of the secondary accent system color at 80% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent2_200">#A4CFC7</color> + <color name="system_accent2_200">#B5CAD7</color> <!-- Shade of the secondary accent system color at 70% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent2_300">#89B4AC</color> + <color name="system_accent2_300">#9AAEBB</color> <!-- Shade of the secondary accent system color at 60% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent2_400">#6F9991</color> + <color name="system_accent2_400">#8094A0</color> <!-- Shade of the secondary accent system color at 49% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent2_500">#537C75</color> + <color name="system_accent2_500">#657985</color> <!-- Shade of the secondary accent system color at 40% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent2_600">#3D665F</color> + <color name="system_accent2_600">#4E616C</color> <!-- Shade of the secondary accent system color at 30% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent2_700">#254E47</color> + <color name="system_accent2_700">#374955</color> <!-- Shade of the secondary accent system color at 20% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent2_800">#0C3731</color> + <color name="system_accent2_800">#20333D</color> <!-- Shade of the secondary accent system color at 10% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent2_900">#00211C</color> + <color name="system_accent2_900">#091E28</color> <!-- Darkest shade of the secondary accent color used by the system. Black. This value can be overlaid at runtime by OverlayManager RROs. --> <color name="system_accent2_1000">#000000</color> @@ -331,34 +331,34 @@ <color name="system_accent3_10">#FFFBFF</color> <!-- Shade of the tertiary accent system color at 95% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent3_50">#F9EAFF</color> + <color name="system_accent3_50">#F5EEFF</color> <!-- Shade of the tertiary accent system color at 90% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent3_100">#ECDBFF</color> + <color name="system_accent3_100">#E6DEFF</color> <!-- Shade of the tertiary accent system color at 80% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent3_200">#CFBFEB</color> + <color name="system_accent3_200">#CAC1EA</color> <!-- Shade of the tertiary accent system color at 70% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent3_300">#B3A4CF</color> + <color name="system_accent3_300">#AEA6CE</color> <!-- Shade of the tertiary accent system color at 60% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent3_400">#988AB3</color> + <color name="system_accent3_400">#938CB1</color> <!-- Shade of the tertiary accent system color at 49% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent3_500">#7B6E96</color> + <color name="system_accent3_500">#787296</color> <!-- Shade of the tertiary accent system color at 40% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent3_600">#64587F</color> + <color name="system_accent3_600">#605A7C</color> <!-- Shade of the tertiary accent system color at 30% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent3_700">#4C4165</color> + <color name="system_accent3_700">#484264</color> <!-- Shade of the tertiary accent system color at 20% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent3_800">#352B4D</color> + <color name="system_accent3_800">#322C4C</color> <!-- Shade of the tertiary accent system color at 10% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_accent3_900">#1E1636</color> + <color name="system_accent3_900">#1D1736</color> <!-- Darkest shade of the tertiary accent color used by the system. Black. This value can be overlaid at runtime by OverlayManager RROs. --> <color name="system_accent3_1000">#000000</color> @@ -368,37 +368,37 @@ <color name="system_neutral1_0">#ffffff</color> <!-- Shade of the neutral system color at 99% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_neutral1_10">#fbfbfb</color> + <color name="system_neutral1_10">#FCFCFF</color> <!-- Shade of the neutral system color at 95% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_neutral1_50">#f0f0f0</color> + <color name="system_neutral1_50">#F0F0F3</color> <!-- Shade of the neutral system color at 90% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_neutral1_100">#e2e2e2</color> + <color name="system_neutral1_100">#E1E3E5</color> <!-- Shade of the neutral system color at 80% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_neutral1_200">#c6c6c6</color> + <color name="system_neutral1_200">#C5C7C9</color> <!-- Shade of the neutral system color at 70% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_neutral1_300">#ababab</color> + <color name="system_neutral1_300">#AAABAE</color> <!-- Shade of the neutral system color at 60% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_neutral1_400">#909090</color> + <color name="system_neutral1_400">#8F9193</color> <!-- Shade of the neutral system color at 49% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_neutral1_500">#757575</color> + <color name="system_neutral1_500">#747679</color> <!-- Shade of the neutral system color at 40% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_neutral1_600">#5e5e5e</color> + <color name="system_neutral1_600">#5C5F61</color> <!-- Shade of the neutral system color at 30% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_neutral1_700">#464646</color> + <color name="system_neutral1_700">#454749</color> <!-- Shade of the neutral system color at 20% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_neutral1_800">#303030</color> + <color name="system_neutral1_800">#2E3133</color> <!-- Shade of the neutral system color at 10% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_neutral1_900">#1b1b1b</color> + <color name="system_neutral1_900">#191C1E</color> <!-- Darkest shade of the neutral color used by the system. Black. This value can be overlaid at runtime by OverlayManager RROs. --> <color name="system_neutral1_1000">#000000</color> @@ -408,37 +408,37 @@ <color name="system_neutral2_0">#ffffff</color> <!-- Shade of the secondary neutral system color at 99% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_neutral2_10">#fbfbfb</color> + <color name="system_neutral2_10">#F9FCFF</color> <!-- Shade of the secondary neutral system color at 95% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_neutral2_50">#f0f0f0</color> + <color name="system_neutral2_50">#EBF1F8</color> <!-- Shade of the secondary neutral system color at 90% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_neutral2_100">#e2e2e2</color> + <color name="system_neutral2_100">#DCE3E9</color> <!-- Shade of the secondary neutral system color at 80% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_neutral2_200">#c6c6c6</color> + <color name="system_neutral2_200">#C0C7CD</color> <!-- Shade of the secondary neutral system color at 70% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_neutral2_300">#ababab</color> + <color name="system_neutral2_300">#A5ACB2</color> <!-- Shade of the secondary neutral system color at 60% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_neutral2_400">#909090</color> + <color name="system_neutral2_400">#8A9297</color> <!-- Shade of the secondary neutral system color at 49% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_neutral2_500">#757575</color> + <color name="system_neutral2_500">#70777C</color> <!-- Shade of the secondary neutral system color at 40% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_neutral2_600">#5e5e5e</color> + <color name="system_neutral2_600">#585F65</color> <!-- Shade of the secondary neutral system color at 30% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_neutral2_700">#464646</color> + <color name="system_neutral2_700">#40484D</color> <!-- Shade of the secondary neutral system color at 20% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_neutral2_800">#303030</color> + <color name="system_neutral2_800">#2A3136</color> <!-- Shade of the secondary neutral system color at 10% lightness. This value can be overlaid at runtime by OverlayManager RROs. --> - <color name="system_neutral2_900">#1b1b1b</color> + <color name="system_neutral2_900">#161C20</color> <!-- Darkest shade of the secondary neutral color used by the system. Black. This value can be overlaid at runtime by OverlayManager RROs. --> <color name="system_neutral2_1000">#000000</color> diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java index 110893765cbd..abbe13ac260f 100644 --- a/services/core/java/com/android/server/display/DisplayPowerController.java +++ b/services/core/java/com/android/server/display/DisplayPowerController.java @@ -2122,7 +2122,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call private void ignoreProximitySensorUntilChangedInternal() { if (!mIgnoreProximityUntilChanged - && mPowerRequest.useProximitySensor && mProximity == PROXIMITY_POSITIVE) { // Only ignore if it is still reporting positive (near) mIgnoreProximityUntilChanged = true; diff --git a/services/core/java/com/android/server/policy/AppOpsPolicy.java b/services/core/java/com/android/server/policy/AppOpsPolicy.java index 18c45e494c9b..8b4690629ec5 100644 --- a/services/core/java/com/android/server/policy/AppOpsPolicy.java +++ b/services/core/java/com/android/server/policy/AppOpsPolicy.java @@ -196,9 +196,8 @@ public final class AppOpsPolicy implements AppOpsManagerInternal.CheckOpsDelegat } private static boolean isHotwordDetectionServiceRequired(PackageManager pm) { - // The HotwordDetectionService APIs aren't ready yet for Auto or TV. - return !(pm.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE) - || pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK)); + // Usage of the HotwordDetectionService won't be enforced until a later release. + return false; } @Override diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java index 9638255dfc79..2b0595492f8a 100644 --- a/services/core/java/com/android/server/power/PowerManagerService.java +++ b/services/core/java/com/android/server/power/PowerManagerService.java @@ -532,6 +532,11 @@ public final class PowerManagerService extends SystemService // True if the proximity sensor reads a positive result. private boolean mProximityPositive; + // Indicates that we have already intercepted the power key to temporarily ignore the proximity + // wake lock and turn the screen back on. This should get reset when prox reads 'far' again + // (when {@link #mProximityPositive} is set to false). + private boolean mInterceptedPowerKeyForProximity; + // Screen brightness setting limits. public final float mScreenBrightnessMinimum; public final float mScreenBrightnessMaximum; @@ -3313,6 +3318,7 @@ public final class PowerManagerService extends SystemService public void onProximityNegative() { synchronized (mLock) { mProximityPositive = false; + mInterceptedPowerKeyForProximity = false; mDirty |= DIRTY_PROXIMITY_POSITIVE; userActivityNoUpdateLocked(Display.DEFAULT_DISPLAY_GROUP, mClock.uptimeMillis(), PowerManager.USER_ACTIVITY_EVENT_OTHER, 0, Process.SYSTEM_UID); @@ -4153,6 +4159,8 @@ public final class PowerManagerService extends SystemService } pw.println(); pw.println(" mRequestWaitForNegativeProximity=" + mRequestWaitForNegativeProximity); + pw.println(" mInterceptedPowerKeyForProximity=" + + mInterceptedPowerKeyForProximity); pw.println(" mSandmanScheduled=" + mSandmanScheduled); pw.println(" mBatteryLevelLow=" + mBatteryLevelLow); pw.println(" mLightDeviceIdleMode=" + mLightDeviceIdleMode); @@ -5984,8 +5992,9 @@ public final class PowerManagerService extends SystemService final DisplayPowerRequest displayPowerRequest = mDisplayGroupPowerStateMapper.getPowerRequestLocked( Display.DEFAULT_DISPLAY_GROUP); - if (displayPowerRequest.useProximitySensor && mProximityPositive) { + if (mProximityPositive && !mInterceptedPowerKeyForProximity) { mDisplayManagerInternal.ignoreProximitySensorUntilChanged(); + mInterceptedPowerKeyForProximity = true; return true; } } diff --git a/services/core/java/com/android/server/soundtrigger_middleware/SoundTriggerMiddlewarePermission.java b/services/core/java/com/android/server/soundtrigger_middleware/SoundTriggerMiddlewarePermission.java index 9999aff3aa91..2b03fe88a1ec 100644 --- a/services/core/java/com/android/server/soundtrigger_middleware/SoundTriggerMiddlewarePermission.java +++ b/services/core/java/com/android/server/soundtrigger_middleware/SoundTriggerMiddlewarePermission.java @@ -125,16 +125,25 @@ public class SoundTriggerMiddlewarePermission implements ISoundTriggerMiddleware * originator temporarily doesn't have the right permissions to use this service. */ private void enforcePermissionsForPreflight(@NonNull Identity identity) { - enforcePermissionForPreflight(mContext, identity, RECORD_AUDIO); - enforcePermissionForPreflight(mContext, identity, CAPTURE_AUDIO_HOTWORD); + enforcePermissionForPreflight(mContext, identity, RECORD_AUDIO, + /* allowSoftDenial= */ true); + enforcePermissionForPreflight(mContext, identity, CAPTURE_AUDIO_HOTWORD, + /* allowSoftDenial= */ true); } /** * Throws a {@link SecurityException} iff the originator has permission to receive data. */ void enforcePermissionsForDataDelivery(@NonNull Identity identity, @NonNull String reason) { - enforcePermissionForDataDelivery(mContext, identity, RECORD_AUDIO, - reason); + // SoundTrigger data is treated the same as Hotword-source audio. This should incur the + // HOTWORD op instead of the RECORD_AUDIO op. The RECORD_AUDIO permission is still required, + // and since this is a data delivery check, soft denials aren't accepted. + enforcePermissionForPreflight(mContext, identity, RECORD_AUDIO, + /* allowSoftDenial= */ false); + int hotwordOp = AppOpsManager.strOpToOp(AppOpsManager.OPSTR_RECORD_AUDIO_HOTWORD); + mContext.getSystemService(AppOpsManager.class).noteOpNoThrow(hotwordOp, identity.uid, + identity.packageName, identity.attributionTag, reason); + enforcePermissionForDataDelivery(mContext, identity, CAPTURE_AUDIO_HOTWORD, reason); } @@ -163,20 +172,25 @@ public class SoundTriggerMiddlewarePermission implements ISoundTriggerMiddleware /** * Throws a {@link SecurityException} if originator permanently doesn't have the given * permission. - * Soft (temporary) denials are considered OK for preflight purposes. * - * @param context A {@link Context}, used for permission checks. - * @param identity The identity to check. - * @param permission The identifier of the permission we want to check. + * @param context A {@link Context}, used for permission checks. + * @param identity The identity to check. + * @param permission The identifier of the permission we want to check. + * @param allowSoftDenial If true, the operation succeeds even for soft (temporary) denials. */ + // TODO: Consider splitting up this method instead of using `allowSoftDenial`, to make it + // clearer when soft denials are not allowed. private static void enforcePermissionForPreflight(@NonNull Context context, - @NonNull Identity identity, @NonNull String permission) { + @NonNull Identity identity, @NonNull String permission, boolean allowSoftDenial) { final int status = PermissionUtil.checkPermissionForPreflight(context, identity, permission); switch (status) { case PermissionChecker.PERMISSION_GRANTED: - case PermissionChecker.PERMISSION_SOFT_DENIED: return; + case PermissionChecker.PERMISSION_SOFT_DENIED: + if (allowSoftDenial) { + return; + } // else fall through case PermissionChecker.PERMISSION_HARD_DENIED: throw new SecurityException( String.format("Failed to obtain permission %s for identity %s", permission, diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java index 734172fc1549..a9aeb985d115 100644 --- a/services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java +++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java @@ -23,11 +23,8 @@ import static android.service.voice.HotwordDetectionService.AUDIO_SOURCE_MICROPH import static android.service.voice.HotwordDetectionService.INITIALIZATION_STATUS_UNKNOWN; import static android.service.voice.HotwordDetectionService.KEY_INITIALIZATION_STATUS; -import static com.android.server.voiceinteraction.SoundTriggerSessionPermissionsDecorator.enforcePermissionForPreflight; - import android.annotation.NonNull; import android.annotation.Nullable; -import android.app.AppOpsManager; import android.content.ComponentName; import android.content.ContentCaptureOptions; import android.content.Context; @@ -935,11 +932,12 @@ final class HotwordDetectionConnection { // TODO: Share this code with SoundTriggerMiddlewarePermission. private void enforcePermissionsForDataDelivery() { Binder.withCleanCallingIdentity(() -> { - enforcePermissionForPreflight(mContext, mVoiceInteractorIdentity, RECORD_AUDIO); - int hotwordOp = AppOpsManager.strOpToOp(AppOpsManager.OPSTR_RECORD_AUDIO_HOTWORD); - mContext.getSystemService(AppOpsManager.class).noteOpNoThrow(hotwordOp, - mVoiceInteractorIdentity.uid, mVoiceInteractorIdentity.packageName, - mVoiceInteractorIdentity.attributionTag, OP_MESSAGE); + // Hack to make sure we show the mic privacy-indicator since the Trusted Hotword + // requirement isn't being enforced for now. Normally, we would note the HOTWORD op here + // instead. + enforcePermissionForDataDelivery(mContext, mVoiceInteractorIdentity, + RECORD_AUDIO, OP_MESSAGE); + enforcePermissionForDataDelivery(mContext, mVoiceInteractorIdentity, CAPTURE_AUDIO_HOTWORD, OP_MESSAGE); }); |