Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +10 −3 Original line number Diff line number Diff line Loading @@ -262,14 +262,21 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL return (secure && !canSkipBouncer) ? SECURE_CAMERA_INTENT : INSECURE_CAMERA_INTENT; } /** * Resolves the intent to launch the camera application. */ public ResolveInfo resolveCameraIntent() { return mContext.getPackageManager().resolveActivityAsUser(getCameraIntent(), PackageManager.MATCH_DEFAULT_ONLY, KeyguardUpdateMonitor.getCurrentUser()); } private void updateCameraVisibility() { if (mCameraImageView == null) { // Things are not set up yet; reply hazy, ask again later return; } ResolveInfo resolved = mContext.getPackageManager().resolveActivityAsUser(getCameraIntent(), PackageManager.MATCH_DEFAULT_ONLY, KeyguardUpdateMonitor.getCurrentUser()); ResolveInfo resolved = resolveCameraIntent(); boolean visible = !isCameraDisabledByDpm() && resolved != null && getResources().getBoolean(R.bool.config_keyguardShowCameraAffordance) && mUserSetupComplete; Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +28 −2 Original line number Diff line number Diff line Loading @@ -21,7 +21,10 @@ import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; import android.animation.ValueAnimator; import android.app.ActivityManager; import android.app.ActivityManager.RunningTaskInfo; import android.content.Context; import android.content.pm.ResolveInfo; import android.content.res.Configuration; import android.graphics.Canvas; import android.graphics.Color; Loading Loading @@ -61,6 +64,8 @@ import com.android.systemui.statusbar.policy.KeyguardUserSwitcher; import com.android.systemui.statusbar.stack.NotificationStackScrollLayout; import com.android.systemui.statusbar.stack.StackStateAnimator; import java.util.List; public class NotificationPanelView extends PanelView implements ExpandableView.OnHeightChangedListener, ObservableScrollView.Listener, View.OnClickListener, NotificationStackScrollLayout.OnOverscrollTopChangedListener, Loading Loading @@ -2425,7 +2430,28 @@ public class NotificationPanelView extends PanelView implements getCenterIcon().setLaunchingAffordance(launchingAffordance); } public boolean canCameraGestureBeLaunched() { return !mAfforanceHelper.isSwipingInProgress(); /** * Whether the camera application can be launched for the camera launch gesture. * * @param keyguardIsShowing whether keyguard is being shown */ public boolean canCameraGestureBeLaunched(boolean keyguardIsShowing) { ResolveInfo resolveInfo = mKeyguardBottomArea.resolveCameraIntent(); String packageToLaunch = (resolveInfo == null || resolveInfo.activityInfo == null) ? null : resolveInfo.activityInfo.packageName; return packageToLaunch != null && (keyguardIsShowing || !isForegroundApp(packageToLaunch)) && !mAfforanceHelper.isSwipingInProgress(); } /** * Return true if the applications with the package name is running in foreground. * * @param pkgName application package name. */ private boolean isForegroundApp(String pkgName) { ActivityManager am = getContext().getSystemService(ActivityManager.class); List<ActivityManager.RunningTaskInfo> tasks = am.getRunningTasks(1); return !tasks.isEmpty() && pkgName.equals(tasks.get(0).topActivity.getPackageName()); } } packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +2 −1 Original line number Diff line number Diff line Loading @@ -4090,7 +4090,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, @Override public void onCameraLaunchGestureDetected() { if (!mNotificationPanel.canCameraGestureBeLaunched()) { if (!mNotificationPanel.canCameraGestureBeLaunched( mStatusBarKeyguardViewManager.isShowing() && mExpandedVisible)) { return; } if (!mDeviceInteractive) { Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +10 −3 Original line number Diff line number Diff line Loading @@ -262,14 +262,21 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL return (secure && !canSkipBouncer) ? SECURE_CAMERA_INTENT : INSECURE_CAMERA_INTENT; } /** * Resolves the intent to launch the camera application. */ public ResolveInfo resolveCameraIntent() { return mContext.getPackageManager().resolveActivityAsUser(getCameraIntent(), PackageManager.MATCH_DEFAULT_ONLY, KeyguardUpdateMonitor.getCurrentUser()); } private void updateCameraVisibility() { if (mCameraImageView == null) { // Things are not set up yet; reply hazy, ask again later return; } ResolveInfo resolved = mContext.getPackageManager().resolveActivityAsUser(getCameraIntent(), PackageManager.MATCH_DEFAULT_ONLY, KeyguardUpdateMonitor.getCurrentUser()); ResolveInfo resolved = resolveCameraIntent(); boolean visible = !isCameraDisabledByDpm() && resolved != null && getResources().getBoolean(R.bool.config_keyguardShowCameraAffordance) && mUserSetupComplete; Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +28 −2 Original line number Diff line number Diff line Loading @@ -21,7 +21,10 @@ import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; import android.animation.ValueAnimator; import android.app.ActivityManager; import android.app.ActivityManager.RunningTaskInfo; import android.content.Context; import android.content.pm.ResolveInfo; import android.content.res.Configuration; import android.graphics.Canvas; import android.graphics.Color; Loading Loading @@ -61,6 +64,8 @@ import com.android.systemui.statusbar.policy.KeyguardUserSwitcher; import com.android.systemui.statusbar.stack.NotificationStackScrollLayout; import com.android.systemui.statusbar.stack.StackStateAnimator; import java.util.List; public class NotificationPanelView extends PanelView implements ExpandableView.OnHeightChangedListener, ObservableScrollView.Listener, View.OnClickListener, NotificationStackScrollLayout.OnOverscrollTopChangedListener, Loading Loading @@ -2425,7 +2430,28 @@ public class NotificationPanelView extends PanelView implements getCenterIcon().setLaunchingAffordance(launchingAffordance); } public boolean canCameraGestureBeLaunched() { return !mAfforanceHelper.isSwipingInProgress(); /** * Whether the camera application can be launched for the camera launch gesture. * * @param keyguardIsShowing whether keyguard is being shown */ public boolean canCameraGestureBeLaunched(boolean keyguardIsShowing) { ResolveInfo resolveInfo = mKeyguardBottomArea.resolveCameraIntent(); String packageToLaunch = (resolveInfo == null || resolveInfo.activityInfo == null) ? null : resolveInfo.activityInfo.packageName; return packageToLaunch != null && (keyguardIsShowing || !isForegroundApp(packageToLaunch)) && !mAfforanceHelper.isSwipingInProgress(); } /** * Return true if the applications with the package name is running in foreground. * * @param pkgName application package name. */ private boolean isForegroundApp(String pkgName) { ActivityManager am = getContext().getSystemService(ActivityManager.class); List<ActivityManager.RunningTaskInfo> tasks = am.getRunningTasks(1); return !tasks.isEmpty() && pkgName.equals(tasks.get(0).topActivity.getPackageName()); } }
packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +2 −1 Original line number Diff line number Diff line Loading @@ -4090,7 +4090,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, @Override public void onCameraLaunchGestureDetected() { if (!mNotificationPanel.canCameraGestureBeLaunched()) { if (!mNotificationPanel.canCameraGestureBeLaunched( mStatusBarKeyguardViewManager.isShowing() && mExpandedVisible)) { return; } if (!mDeviceInteractive) { Loading