Loading core/java/com/android/internal/statusbar/IStatusBar.aidl +7 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,13 @@ oneway interface IStatusBar */ void onCameraLaunchGestureDetected(int source); /** * Notifies the status bar that the Emergency Action launch gesture has been detected. * * TODO(b/169175022) Update method name and docs when feature name is locked. */ void onEmergencyActionLaunchGestureDetected(); /** * Shows the picture-in-picture menu if an activity is in picture-in-picture mode. */ Loading packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java +19 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,8 @@ public class CommandQueue extends IStatusBar.Stub implements CallbackController< private static final int MSG_SUPPRESS_AMBIENT_DISPLAY = 56 << MSG_SHIFT; private static final int MSG_REQUEST_WINDOW_MAGNIFICATION_CONNECTION = 57 << MSG_SHIFT; private static final int MSG_HANDLE_WINDOW_MANAGER_LOGGING_COMMAND = 58 << MSG_SHIFT; //TODO(b/169175022) Update name and when feature name is locked. private static final int MSG_EMERGENCY_ACTION_LAUNCH_GESTURE = 59 << MSG_SHIFT; public static final int FLAG_EXCLUDE_NONE = 0; public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 0; Loading Loading @@ -258,6 +260,11 @@ public class CommandQueue extends IStatusBar.Stub implements CallbackController< default void showAssistDisclosure() { } default void startAssist(Bundle args) { } default void onCameraLaunchGestureDetected(int source) { } /** * Notifies SysUI that the emergency action gesture was detected. */ default void onEmergencyActionLaunchGestureDetected() { } default void showPictureInPictureMenu() { } default void setTopAppHidesStatusBar(boolean topAppHidesStatusBar) { } Loading Loading @@ -729,6 +736,14 @@ public class CommandQueue extends IStatusBar.Stub implements CallbackController< } } @Override public void onEmergencyActionLaunchGestureDetected() { synchronized (mLock) { mHandler.removeMessages(MSG_EMERGENCY_ACTION_LAUNCH_GESTURE); mHandler.obtainMessage(MSG_EMERGENCY_ACTION_LAUNCH_GESTURE).sendToTarget(); } } @Override public void addQsTile(ComponentName tile) { synchronized (mLock) { Loading Loading @@ -1186,6 +1201,10 @@ public class CommandQueue extends IStatusBar.Stub implements CallbackController< mCallbacks.get(i).onCameraLaunchGestureDetected(msg.arg1); } break; case MSG_EMERGENCY_ACTION_LAUNCH_GESTURE: for (int i = 0; i < mCallbacks.size(); i++) { mCallbacks.get(i).onEmergencyActionLaunchGestureDetected(); } case MSG_SHOW_PICTURE_IN_PICTURE_MENU: for (int i = 0; i < mCallbacks.size(); i++) { mCallbacks.get(i).showPictureInPictureMenu(); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +24 −3 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ import android.content.IntentFilter; import android.content.pm.IPackageManager; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.ResolveInfo; import android.content.res.Configuration; import android.graphics.Point; import android.graphics.PointF; Loading Loading @@ -152,6 +153,7 @@ import com.android.systemui.dagger.qualifiers.UiBackground; import com.android.systemui.demomode.DemoMode; import com.android.systemui.demomode.DemoModeCommandReceiver; import com.android.systemui.demomode.DemoModeController; import com.android.systemui.emergency.EmergencyGesture; import com.android.systemui.fragments.ExtensionFragmentListener; import com.android.systemui.fragments.FragmentHostManager; import com.android.systemui.keyguard.DismissCallbackRegistry; Loading Loading @@ -819,7 +821,7 @@ public class StatusBar extends SystemUI implements DemoMode, updateScrimController(); }; mActivityIntentHelper = new ActivityIntentHelper(mContext); DateTimeView.setReceiverHandler(timeTickHandler); } Loading @@ -833,8 +835,6 @@ public class StatusBar extends SystemUI implements DemoMode, mBubblesOptional.get().setExpandListener(mBubbleExpandListener); } mActivityIntentHelper = new ActivityIntentHelper(mContext); mColorExtractor.addOnColorsChangedListener(this); mStatusBarStateController.addCallback(this, SysuiStatusBarStateController.RANK_STATUS_BAR); Loading Loading @@ -3980,6 +3980,27 @@ public class StatusBar extends SystemUI implements DemoMode, } } @Override public void onEmergencyActionLaunchGestureDetected() { // TODO (b/169793384) Polish the panic gesture to be just like its older brother, camera. Intent emergencyIntent = new Intent(EmergencyGesture.ACTION_LAUNCH_EMERGENCY); PackageManager pm = mContext.getPackageManager(); ResolveInfo resolveInfo = pm.resolveActivity(emergencyIntent, /*flags=*/0); if (resolveInfo == null) { Log.wtf(TAG, "Couldn't find an app to process the emergency intent."); return; } if (mVibrator != null && mVibrator.hasVibrator()) { mVibrator.vibrate(500L); } emergencyIntent.setComponent(new ComponentName(resolveInfo.activityInfo.packageName, resolveInfo.activityInfo.name)); emergencyIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(emergencyIntent, /*dismissShade=*/true); } boolean isCameraAllowedByAdmin() { if (mDevicePolicyManager.getCameraDisabled(null, mLockscreenUserManager.getCurrentUserId())) { Loading packages/SystemUI/tests/AndroidManifest.xml +7 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,13 @@ android:exported="false" android:resizeableActivity="true" /> <activity android:name="com.android.systemui.emergency.EmergencyActivityTest" android:exported="true"> <intent-filter> <action android:name="com.android.systemui.action.LAUNCH_EMERGENCY"/> </intent-filter> </activity> <activity android:name="com.android.systemui.globalactions.GlobalActionsImeTest$TestActivity" android:excludeFromRecents="true" Loading packages/SystemUI/tests/src/com/android/systemui/emergency/EmergencyActivityTest.java 0 → 100644 +34 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.emergency; import android.app.Activity; import android.os.Bundle; import com.android.systemui.R; /** * Test activity for resolving {@link EmergencyGesture#ACTION_LAUNCH_EMERGENCY} action. */ public class EmergencyActivityTest extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } } Loading
core/java/com/android/internal/statusbar/IStatusBar.aidl +7 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,13 @@ oneway interface IStatusBar */ void onCameraLaunchGestureDetected(int source); /** * Notifies the status bar that the Emergency Action launch gesture has been detected. * * TODO(b/169175022) Update method name and docs when feature name is locked. */ void onEmergencyActionLaunchGestureDetected(); /** * Shows the picture-in-picture menu if an activity is in picture-in-picture mode. */ Loading
packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java +19 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,8 @@ public class CommandQueue extends IStatusBar.Stub implements CallbackController< private static final int MSG_SUPPRESS_AMBIENT_DISPLAY = 56 << MSG_SHIFT; private static final int MSG_REQUEST_WINDOW_MAGNIFICATION_CONNECTION = 57 << MSG_SHIFT; private static final int MSG_HANDLE_WINDOW_MANAGER_LOGGING_COMMAND = 58 << MSG_SHIFT; //TODO(b/169175022) Update name and when feature name is locked. private static final int MSG_EMERGENCY_ACTION_LAUNCH_GESTURE = 59 << MSG_SHIFT; public static final int FLAG_EXCLUDE_NONE = 0; public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 0; Loading Loading @@ -258,6 +260,11 @@ public class CommandQueue extends IStatusBar.Stub implements CallbackController< default void showAssistDisclosure() { } default void startAssist(Bundle args) { } default void onCameraLaunchGestureDetected(int source) { } /** * Notifies SysUI that the emergency action gesture was detected. */ default void onEmergencyActionLaunchGestureDetected() { } default void showPictureInPictureMenu() { } default void setTopAppHidesStatusBar(boolean topAppHidesStatusBar) { } Loading Loading @@ -729,6 +736,14 @@ public class CommandQueue extends IStatusBar.Stub implements CallbackController< } } @Override public void onEmergencyActionLaunchGestureDetected() { synchronized (mLock) { mHandler.removeMessages(MSG_EMERGENCY_ACTION_LAUNCH_GESTURE); mHandler.obtainMessage(MSG_EMERGENCY_ACTION_LAUNCH_GESTURE).sendToTarget(); } } @Override public void addQsTile(ComponentName tile) { synchronized (mLock) { Loading Loading @@ -1186,6 +1201,10 @@ public class CommandQueue extends IStatusBar.Stub implements CallbackController< mCallbacks.get(i).onCameraLaunchGestureDetected(msg.arg1); } break; case MSG_EMERGENCY_ACTION_LAUNCH_GESTURE: for (int i = 0; i < mCallbacks.size(); i++) { mCallbacks.get(i).onEmergencyActionLaunchGestureDetected(); } case MSG_SHOW_PICTURE_IN_PICTURE_MENU: for (int i = 0; i < mCallbacks.size(); i++) { mCallbacks.get(i).showPictureInPictureMenu(); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +24 −3 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ import android.content.IntentFilter; import android.content.pm.IPackageManager; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.ResolveInfo; import android.content.res.Configuration; import android.graphics.Point; import android.graphics.PointF; Loading Loading @@ -152,6 +153,7 @@ import com.android.systemui.dagger.qualifiers.UiBackground; import com.android.systemui.demomode.DemoMode; import com.android.systemui.demomode.DemoModeCommandReceiver; import com.android.systemui.demomode.DemoModeController; import com.android.systemui.emergency.EmergencyGesture; import com.android.systemui.fragments.ExtensionFragmentListener; import com.android.systemui.fragments.FragmentHostManager; import com.android.systemui.keyguard.DismissCallbackRegistry; Loading Loading @@ -819,7 +821,7 @@ public class StatusBar extends SystemUI implements DemoMode, updateScrimController(); }; mActivityIntentHelper = new ActivityIntentHelper(mContext); DateTimeView.setReceiverHandler(timeTickHandler); } Loading @@ -833,8 +835,6 @@ public class StatusBar extends SystemUI implements DemoMode, mBubblesOptional.get().setExpandListener(mBubbleExpandListener); } mActivityIntentHelper = new ActivityIntentHelper(mContext); mColorExtractor.addOnColorsChangedListener(this); mStatusBarStateController.addCallback(this, SysuiStatusBarStateController.RANK_STATUS_BAR); Loading Loading @@ -3980,6 +3980,27 @@ public class StatusBar extends SystemUI implements DemoMode, } } @Override public void onEmergencyActionLaunchGestureDetected() { // TODO (b/169793384) Polish the panic gesture to be just like its older brother, camera. Intent emergencyIntent = new Intent(EmergencyGesture.ACTION_LAUNCH_EMERGENCY); PackageManager pm = mContext.getPackageManager(); ResolveInfo resolveInfo = pm.resolveActivity(emergencyIntent, /*flags=*/0); if (resolveInfo == null) { Log.wtf(TAG, "Couldn't find an app to process the emergency intent."); return; } if (mVibrator != null && mVibrator.hasVibrator()) { mVibrator.vibrate(500L); } emergencyIntent.setComponent(new ComponentName(resolveInfo.activityInfo.packageName, resolveInfo.activityInfo.name)); emergencyIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(emergencyIntent, /*dismissShade=*/true); } boolean isCameraAllowedByAdmin() { if (mDevicePolicyManager.getCameraDisabled(null, mLockscreenUserManager.getCurrentUserId())) { Loading
packages/SystemUI/tests/AndroidManifest.xml +7 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,13 @@ android:exported="false" android:resizeableActivity="true" /> <activity android:name="com.android.systemui.emergency.EmergencyActivityTest" android:exported="true"> <intent-filter> <action android:name="com.android.systemui.action.LAUNCH_EMERGENCY"/> </intent-filter> </activity> <activity android:name="com.android.systemui.globalactions.GlobalActionsImeTest$TestActivity" android:excludeFromRecents="true" Loading
packages/SystemUI/tests/src/com/android/systemui/emergency/EmergencyActivityTest.java 0 → 100644 +34 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.emergency; import android.app.Activity; import android.os.Bundle; import com.android.systemui.R; /** * Test activity for resolving {@link EmergencyGesture#ACTION_LAUNCH_EMERGENCY} action. */ public class EmergencyActivityTest extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } }