Loading packages/SystemUI/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -580,6 +580,9 @@ <!-- Whether wallet view is shown in landscape / seascape orientations --> <bool name="global_actions_show_landscape_wallet_view">false</bool> <!-- Package name of the preferred system app to perform eSOS action --> <string name="config_preferredEmergencySosPackage" translatable="false"></string> <!-- Whether to use the split 2-column notification shade --> <bool name="config_use_split_notification_shade">false</bool> Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +32 −1 Original line number Diff line number Diff line Loading @@ -95,6 +95,7 @@ import android.provider.Settings; import android.service.dreams.DreamService; import android.service.dreams.IDreamManager; import android.service.notification.StatusBarNotification; import android.text.TextUtils; import android.util.ArraySet; import android.util.DisplayMetrics; import android.util.EventLog; Loading Loading @@ -4071,7 +4072,9 @@ public class StatusBar extends SystemUI implements DemoMode, private @Nullable Intent getEmergencyActionIntent() { Intent emergencyIntent = new Intent(EmergencyGesture.ACTION_LAUNCH_EMERGENCY); PackageManager pm = mContext.getPackageManager(); ResolveInfo resolveInfo = pm.resolveActivity(emergencyIntent, /*flags=*/0); List<ResolveInfo> emergencyActivities = pm.queryIntentActivities(emergencyIntent, PackageManager.MATCH_SYSTEM_ONLY); ResolveInfo resolveInfo = getTopEmergencySosInfo(emergencyActivities); if (resolveInfo == null) { Log.wtf(TAG, "Couldn't find an app to process the emergency intent."); return null; Loading @@ -4082,6 +4085,34 @@ public class StatusBar extends SystemUI implements DemoMode, return emergencyIntent; } /** * Select and return the "best" ResolveInfo for Emergency SOS Activity. */ private @Nullable ResolveInfo getTopEmergencySosInfo(List<ResolveInfo> emergencyActivities) { // No matched activity. if (emergencyActivities == null || emergencyActivities.isEmpty()) { return null; } // Of multiple matched Activities, give preference to the pre-set package name. String preferredAppPackageName = mContext.getString(R.string.config_preferredEmergencySosPackage); // If there is no preferred app, then return first match. if (TextUtils.isEmpty(preferredAppPackageName)) { return emergencyActivities.get(0); } for (ResolveInfo emergencyInfo: emergencyActivities) { // If activity is from the preferred app, use it. if (TextUtils.equals(emergencyInfo.activityInfo.packageName, preferredAppPackageName)) { return emergencyInfo; } } // No matching activity: return first match return emergencyActivities.get(0); } boolean isCameraAllowedByAdmin() { if (mDevicePolicyManager.getCameraDisabled(null, mLockscreenUserManager.getCurrentUserId())) { Loading Loading
packages/SystemUI/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -580,6 +580,9 @@ <!-- Whether wallet view is shown in landscape / seascape orientations --> <bool name="global_actions_show_landscape_wallet_view">false</bool> <!-- Package name of the preferred system app to perform eSOS action --> <string name="config_preferredEmergencySosPackage" translatable="false"></string> <!-- Whether to use the split 2-column notification shade --> <bool name="config_use_split_notification_shade">false</bool> Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +32 −1 Original line number Diff line number Diff line Loading @@ -95,6 +95,7 @@ import android.provider.Settings; import android.service.dreams.DreamService; import android.service.dreams.IDreamManager; import android.service.notification.StatusBarNotification; import android.text.TextUtils; import android.util.ArraySet; import android.util.DisplayMetrics; import android.util.EventLog; Loading Loading @@ -4071,7 +4072,9 @@ public class StatusBar extends SystemUI implements DemoMode, private @Nullable Intent getEmergencyActionIntent() { Intent emergencyIntent = new Intent(EmergencyGesture.ACTION_LAUNCH_EMERGENCY); PackageManager pm = mContext.getPackageManager(); ResolveInfo resolveInfo = pm.resolveActivity(emergencyIntent, /*flags=*/0); List<ResolveInfo> emergencyActivities = pm.queryIntentActivities(emergencyIntent, PackageManager.MATCH_SYSTEM_ONLY); ResolveInfo resolveInfo = getTopEmergencySosInfo(emergencyActivities); if (resolveInfo == null) { Log.wtf(TAG, "Couldn't find an app to process the emergency intent."); return null; Loading @@ -4082,6 +4085,34 @@ public class StatusBar extends SystemUI implements DemoMode, return emergencyIntent; } /** * Select and return the "best" ResolveInfo for Emergency SOS Activity. */ private @Nullable ResolveInfo getTopEmergencySosInfo(List<ResolveInfo> emergencyActivities) { // No matched activity. if (emergencyActivities == null || emergencyActivities.isEmpty()) { return null; } // Of multiple matched Activities, give preference to the pre-set package name. String preferredAppPackageName = mContext.getString(R.string.config_preferredEmergencySosPackage); // If there is no preferred app, then return first match. if (TextUtils.isEmpty(preferredAppPackageName)) { return emergencyActivities.get(0); } for (ResolveInfo emergencyInfo: emergencyActivities) { // If activity is from the preferred app, use it. if (TextUtils.equals(emergencyInfo.activityInfo.packageName, preferredAppPackageName)) { return emergencyInfo; } } // No matching activity: return first match return emergencyActivities.get(0); } boolean isCameraAllowedByAdmin() { if (mDevicePolicyManager.getCameraDisabled(null, mLockscreenUserManager.getCurrentUserId())) { Loading