OSDN Git Service

Block camera gesture during secondary user SUW
authorAmith Yamasani <yamasani@google.com>
Fri, 15 Jul 2016 22:33:03 +0000 (15:33 -0700)
committerAmith Yamasani <yamasani@google.com>
Fri, 15 Jul 2016 22:33:03 +0000 (15:33 -0700)
Check for the current user's setup_complete state
before acting on the double-tap on power camera
launcher.

Bug: 30155500
Change-Id: I2ee8601411d270e288410e9d22ae07b97fa0de70

services/core/java/com/android/server/GestureLauncherService.java

index 5a90488..553cb07 100644 (file)
@@ -33,6 +33,7 @@ import android.os.PowerManager;
 import android.os.PowerManager.WakeLock;
 import android.os.SystemClock;
 import android.os.SystemProperties;
+import android.os.UserHandle;
 import android.provider.Settings;
 import android.util.MutableBoolean;
 import android.util.Slog;
@@ -284,8 +285,8 @@ public class GestureLauncherService extends SystemService {
      * @return true if camera was launched, false otherwise.
      */
     private boolean handleCameraLaunchGesture(boolean useWakelock, int source) {
-        boolean userSetupComplete = Settings.Secure.getInt(mContext.getContentResolver(),
-                Settings.Secure.USER_SETUP_COMPLETE, 0) != 0;
+        boolean userSetupComplete = Settings.Secure.getIntForUser(mContext.getContentResolver(),
+                Settings.Secure.USER_SETUP_COMPLETE, 0, UserHandle.USER_CURRENT) != 0;
         if (!userSetupComplete) {
             if (DBG) Slog.d(TAG, String.format(
                     "userSetupComplete = %s, ignoring camera launch gesture.",