From 08a8c4371af1a03115d748dd80df478e0afdd60c Mon Sep 17 00:00:00 2001 From: Varun Shah Date: Sat, 6 May 2023 00:13:39 +0000 Subject: [PATCH 1/5] Ensure only valid events are reported. When CHOOSER_ACTION events are reported via reportChooserSelection, make sure the package name is not null and is also a valid, installed package. Bug: 229633537 Bug: 253403242 Test: atest UsageStatsTest Change-Id: Ib28014f2d21b451d2f7f6e7136f500fc49d0779b --- .../com/android/server/usage/UsageStatsService.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/services/usage/java/com/android/server/usage/UsageStatsService.java b/services/usage/java/com/android/server/usage/UsageStatsService.java index a98429ad4902f..72f2c1ddfc771 100644 --- a/services/usage/java/com/android/server/usage/UsageStatsService.java +++ b/services/usage/java/com/android/server/usage/UsageStatsService.java @@ -2539,10 +2539,14 @@ public class UsageStatsService extends SystemService implements } @Override - public void reportChooserSelection(String packageName, int userId, String contentType, - String[] annotations, String action) { + public void reportChooserSelection(@NonNull String packageName, int userId, + String contentType, String[] annotations, String action) { if (packageName == null) { - Slog.w(TAG, "Event report user selecting a null package"); + throw new IllegalArgumentException("Package selection must not be null."); + } + // Verify if this package exists before reporting an event for it. + if (mPackageManagerInternal.getPackageUid(packageName, 0, userId) < 0) { + Slog.w(TAG, "Event report user selecting an invalid package"); return; } From 435ee9b979dc21c5063bb5ffbfdb35c3f321bffc Mon Sep 17 00:00:00 2001 From: lbill Date: Wed, 26 Apr 2023 19:26:40 +0000 Subject: [PATCH 2/5] Disable 3-Button NavBar Recents key when launch secure camera In general, recents key is useless in double click power key launch camera CUJ, we can hide recents to prevent user click and invoke Keyguard face auth while the camera is running concurrently. And at the moment, face auth is not able to access camera, then fallback to fingerprint authentication. While user see dim beyond camera preview, and face auth not work bring bad UX to user, disable Recent key in the scenario sounds make sense. Bug: 268593702 Test: Double click to launch camera in 3-button Nav mode make sure recent key is hide Test: atest KeyguardViewMediatorTest Change-Id: I5cc50b8bb49725f6e53445bdd1c9e3a8d0a15a88 --- .../keyguard/KeyguardViewMediator.java | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 99a9bed5a2bbc..419ecf0fa1d28 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -1463,13 +1463,17 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, notifyFinishedGoingToSleep(); if (cameraGestureTriggered) { - // Just to make sure, make sure the device is awake. mContext.getSystemService(PowerManager.class).wakeUp(SystemClock.uptimeMillis(), PowerManager.WAKE_REASON_CAMERA_LAUNCH, "com.android.systemui:CAMERA_GESTURE_PREVENT_LOCK"); setPendingLock(false); mPendingReset = false; + mPowerGestureIntercepted = true; + if (DEBUG) { + Log.d(TAG, "cameraGestureTriggered=" + cameraGestureTriggered + + ",mPowerGestureIntercepted=" + mPowerGestureIntercepted); + } } if (mPendingReset) { @@ -1668,7 +1672,13 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, mAnimatingScreenOff = false; cancelDoKeyguardLaterLocked(); cancelDoKeyguardForChildProfilesLocked(); - if (DEBUG) Log.d(TAG, "onStartedWakingUp, seq = " + mDelayedShowingSequence); + if (cameraGestureTriggered) { + mPowerGestureIntercepted = true; + } + if (DEBUG) { + Log.d(TAG, "onStartedWakingUp, seq = " + mDelayedShowingSequence + + ", mPowerGestureIntercepted = " + mPowerGestureIntercepted); + } notifyStartedWakingUp(); } mUpdateMonitor.dispatchStartedWakingUp(pmWakeReason); @@ -1884,12 +1894,19 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, startKeyguardExitAnimation(0, 0); } + mPowerGestureIntercepted = mUpdateMonitor.isSecureCameraLaunchedOverKeyguard(); + if (mOccluded != isOccluded) { mOccluded = isOccluded; mKeyguardViewControllerLazy.get().setOccluded(isOccluded, animate && mDeviceInteractive); adjustStatusBarLocked(); } + + if (DEBUG) { + Log.d(TAG, "isOccluded=" + isOccluded + ",mPowerGestureIntercepted=" + + mPowerGestureIntercepted); + } } Trace.endSection(); } @@ -2996,6 +3013,10 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, flags |= StatusBarManager.DISABLE_RECENT; } + if (mPowerGestureIntercepted) { + flags |= StatusBarManager.DISABLE_RECENT; + } + if (DEBUG) { Log.d(TAG, "adjustStatusBarLocked: mShowing=" + mShowing + " mOccluded=" + mOccluded + " isSecure=" + isSecure() + " force=" + forceHideHomeRecentsButtons From a29dfab3e5c25df627cf6a4bee87c4f5a391f8b1 Mon Sep 17 00:00:00 2001 From: Lucas Silva Date: Thu, 11 May 2023 16:21:22 -0400 Subject: [PATCH 3/5] Update custom clock flag to a resource This will allow the flag to be overridden on a per-device basis. Bug: 281528246 Test: mp droid and verified that clocks are no longer present on device which overrides this resource to false Change-Id: I73022590bb61a28ee03166a9a29981efb090ded9 --- packages/SystemUI/res-keyguard/values/config.xml | 2 ++ packages/SystemUI/src/com/android/systemui/flags/Flags.kt | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/res-keyguard/values/config.xml b/packages/SystemUI/res-keyguard/values/config.xml index a25ab5109fa80..d50355140bed9 100644 --- a/packages/SystemUI/res-keyguard/values/config.xml +++ b/packages/SystemUI/res-keyguard/values/config.xml @@ -28,6 +28,8 @@ false + + true 3500 diff --git a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt index 09601970e96a5..4c4f99b424572 100644 --- a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt +++ b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt @@ -115,7 +115,12 @@ object Flags { resourceBooleanFlag(204, R.bool.config_enableBouncerUserSwitcher, "bouncer_user_switcher") // TODO(b/254512676): Tracking Bug - @JvmField val LOCKSCREEN_CUSTOM_CLOCKS = releasedFlag(207, "lockscreen_custom_clocks") + @JvmField + val LOCKSCREEN_CUSTOM_CLOCKS = resourceBooleanFlag( + 207, + R.bool.config_enableLockScreenCustomClocks, + "lockscreen_custom_clocks" + ) // TODO(b/275694445): Tracking Bug @JvmField From 28f42bba3230d71765278d76b2edda71486a5b75 Mon Sep 17 00:00:00 2001 From: Yabin Cui Date: Thu, 11 May 2023 14:25:22 -0700 Subject: [PATCH 4/5] ProfcollectForwardingService: Pass usage setting when reporting Bug: 282060259 Test: run am broadcast -a com.android.server.profcollect.UPLOAD_PROFILES Change-Id: I891d10d023766009903383abb6421f3947f5f612 --- .../profcollect/ProfcollectForwardingService.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java b/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java index 8f23ae4ff33be..4007672a0599c 100644 --- a/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java +++ b/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java @@ -34,6 +34,8 @@ import android.os.SystemProperties; import android.os.UpdateEngine; import android.os.UpdateEngineCallback; import android.provider.DeviceConfig; +import android.provider.Settings; +import android.provider.Settings.SettingNotFoundException; import android.util.Log; import com.android.internal.R; @@ -332,8 +334,17 @@ public final class ProfcollectForwardingService extends SystemService { Context context = getContext(); BackgroundThread.get().getThreadHandler().post(() -> { try { + int usageSetting = -1; + try { + // Get "Usage & diagnostics" checkbox status. 1 is for enabled, 0 is for + // disabled. + usageSetting = Settings.Global.getInt(context.getContentResolver(), "multi_cb"); + } catch (SettingNotFoundException e) { + Log.i(LOG_TAG, "Usage setting not found: " + e.getMessage()); + } + // Prepare profile report - String reportName = mIProfcollect.report() + ".zip"; + String reportName = mIProfcollect.report(usageSetting) + ".zip"; if (!context.getResources().getBoolean( R.bool.config_profcollectReportUploaderEnabled)) { From f43fef0a564f16d334332b68c74c514ec37d7bda Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 12 May 2023 11:43:37 -0700 Subject: [PATCH 5/5] Fix incorrect evaluation of TvMessage count Bug: 278628657 Test: atest TvInputServiceTest Change-Id: Ica32ffc82ec1f6850df113397ed9bd5f555eaf58 --- services/core/jni/tvinput/JTvInputHal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/jni/tvinput/JTvInputHal.cpp b/services/core/jni/tvinput/JTvInputHal.cpp index c494044e8e183..a3eb3906cc653 100644 --- a/services/core/jni/tvinput/JTvInputHal.cpp +++ b/services/core/jni/tvinput/JTvInputHal.cpp @@ -418,7 +418,7 @@ JTvInputHal::TvInputCallback::TvInputCallback(JTvInputHal* hal) { ::ndk::ScopedAStatus JTvInputHal::TvInputCallback::notifyTvMessageEvent( const AidlTvMessageEvent& event) { const std::string DEVICE_ID_SUBTYPE = "device_id"; - if (sizeof(event.messages) > 0 && event.messages[0].subType == DEVICE_ID_SUBTYPE) { + if (event.messages.size() > 1 && event.messages[0].subType == DEVICE_ID_SUBTYPE) { mHal->mLooper ->sendMessage(new NotifyTvMessageHandler(mHal, TvMessageEventWrapper::createEventWrapper(