diff options
author | Selim Cinek <cinek@google.com> | 2015-08-26 17:20:50 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-08-26 17:20:50 +0000 |
commit | a07177f0ad362ab3e03029cf774e55579ea025cf (patch) | |
tree | 397eaca01fc8b086f8319564377cc2838461936a /services/core | |
parent | a67f961f4fbfed081bb87880a2251564642fd32a (diff) | |
parent | 372d1bdd54fe977c71bdaae895687c76ac35202a (diff) | |
download | frameworks_base-a07177f0ad362ab3e03029cf774e55579ea025cf.zip frameworks_base-a07177f0ad362ab3e03029cf774e55579ea025cf.tar.gz frameworks_base-a07177f0ad362ab3e03029cf774e55579ea025cf.tar.bz2 |
Merge "Launching the camera now from systemUI including animations" into mnc-dr-dev
Diffstat (limited to 'services/core')
4 files changed, 21 insertions, 28 deletions
diff --git a/services/core/java/com/android/server/GestureLauncherService.java b/services/core/java/com/android/server/GestureLauncherService.java index 55af9f0..0fb0470 100644 --- a/services/core/java/com/android/server/GestureLauncherService.java +++ b/services/core/java/com/android/server/GestureLauncherService.java @@ -19,12 +19,9 @@ package com.android.server; import android.app.ActivityManager; import android.app.KeyguardManager; import android.content.BroadcastReceiver; -import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; -import android.content.pm.PackageManager; -import android.content.pm.ResolveInfo; import android.content.res.Resources; import android.database.ContentObserver; import android.hardware.Sensor; @@ -35,12 +32,12 @@ import android.os.Handler; import android.os.PowerManager; import android.os.PowerManager.WakeLock; import android.os.SystemProperties; -import android.os.UserHandle; import android.os.Vibrator; -import android.provider.MediaStore; import android.provider.Settings; import android.util.Slog; +import com.android.server.statusbar.StatusBarManagerInternal; + /** * The service that listens for gestures detected in sensor firmware and starts the intent * accordingly. @@ -57,7 +54,6 @@ class GestureLauncherService extends SystemService { private Sensor mCameraLaunchSensor; private Vibrator mVibrator; - private KeyguardManager mKeyGuard; private Context mContext; /** The wake lock held when a gesture is detected. */ @@ -83,11 +79,9 @@ class GestureLauncherService extends SystemService { } mVibrator = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE); - mKeyGuard = (KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE); PowerManager powerManager = (PowerManager) mContext.getSystemService( Context.POWER_SERVICE); - mWakeLock = powerManager.newWakeLock( - PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, + mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "GestureLauncherService"); updateCameraRegistered(); @@ -227,29 +221,17 @@ class GestureLauncherService extends SystemService { if (DBG) Slog.d(TAG, String.format( "userSetupComplete = %s, performing camera launch gesture.", userSetupComplete)); - boolean locked = mKeyGuard != null && mKeyGuard.inKeyguardRestrictedInputMode(); - String action = locked - ? MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE - : MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA; - Intent intent = new Intent(action); - PackageManager pm = mContext.getPackageManager(); - ResolveInfo componentInfo = pm.resolveActivity(intent, - PackageManager.MATCH_DEFAULT_ONLY); - if (componentInfo == null) { - if (DBG) Slog.d(TAG, "Couldn't find an app to process the camera intent."); - return; - } if (mVibrator != null && mVibrator.hasVibrator()) { mVibrator.vibrate(1000L); } - // Turn on the screen before the camera launches. + // Make sure we don't sleep too early mWakeLock.acquire(500L); - intent.setComponent(new ComponentName(componentInfo.activityInfo.packageName, - componentInfo.activityInfo.name)); - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - mContext.startActivityAsUser(intent, UserHandle.CURRENT); + StatusBarManagerInternal service = LocalServices.getService( + StatusBarManagerInternal.class); + service.onCameraLaunchGestureDetected(); mWakeLock.release(); + } @Override diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index 5b0c06b..0423aa3 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -4410,7 +4410,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (mAppsToBeHidden.isEmpty()) { if (dismissKeyguard && !mKeyguardSecure) { mAppsThatDismissKeyguard.add(appToken); - } else { + } else if (win.isDrawnLw()) { mWinShowWhenLocked = win; mHideLockScreen = true; mForceStatusBarFromKeyguard = false; @@ -4444,7 +4444,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { mWinDismissingKeyguard = win; mSecureDismissingKeyguard = mKeyguardSecure; mForceStatusBarFromKeyguard = mShowingLockscreen && mKeyguardSecure; - } else if (mAppsToBeHidden.isEmpty() && showWhenLocked) { + } else if (mAppsToBeHidden.isEmpty() && showWhenLocked && win.isDrawnLw()) { if (DEBUG_LAYOUT) Slog.v(TAG, "Setting mHideLockScreen to true by win " + win); mHideLockScreen = true; diff --git a/services/core/java/com/android/server/statusbar/StatusBarManagerInternal.java b/services/core/java/com/android/server/statusbar/StatusBarManagerInternal.java index 130815e..5d01931 100644 --- a/services/core/java/com/android/server/statusbar/StatusBarManagerInternal.java +++ b/services/core/java/com/android/server/statusbar/StatusBarManagerInternal.java @@ -28,4 +28,5 @@ public interface StatusBarManagerInternal { void showScreenPinningRequest(); void showAssistDisclosure(); void startAssist(Bundle args); + void onCameraLaunchGestureDetected(); } diff --git a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java index 2a817ea..0fb1169 100644 --- a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java +++ b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java @@ -176,6 +176,16 @@ public class StatusBarManagerService extends IStatusBarService.Stub { } } } + + @Override + public void onCameraLaunchGestureDetected() { + if (mBar != null) { + try { + mBar.onCameraLaunchGestureDetected(); + } catch (RemoteException e) { + } + } + } }; // ================================================================================ |