Merge "Merge "Emergency location notification text must be in the correct language" into qt-dev am: 1c60a7c773 am: ac7800011d" into qt-r1-dev-plus-aosp

This commit is contained in:
Android Build Merger (Role)
2019-06-12 01:39:53 +00:00
committed by Android (Google) Code Review

View File

@@ -78,7 +78,6 @@ class GnssVisibilityControl {
private final Handler mHandler; private final Handler mHandler;
private final Context mContext; private final Context mContext;
private final GpsNetInitiatedHandler mNiHandler; private final GpsNetInitiatedHandler mNiHandler;
private final Notification mEmergencyLocationUserNotification;
private boolean mIsGpsEnabled; private boolean mIsGpsEnabled;
@@ -107,7 +106,6 @@ class GnssVisibilityControl {
mNiHandler = niHandler; mNiHandler = niHandler;
mAppOps = mContext.getSystemService(AppOpsManager.class); mAppOps = mContext.getSystemService(AppOpsManager.class);
mPackageManager = mContext.getPackageManager(); mPackageManager = mContext.getPackageManager();
mEmergencyLocationUserNotification = createEmergencyLocationUserNotification(mContext);
// Complete initialization as the first event to run in mHandler thread. After that, // Complete initialization as the first event to run in mHandler thread. After that,
// all object state read/update events run in the mHandler thread. // all object state read/update events run in the mHandler thread.
@@ -632,13 +630,15 @@ class GnssVisibilityControl {
} }
notificationManager.notifyAsUser(/* tag= */ null, /* notificationId= */ 0, notificationManager.notifyAsUser(/* tag= */ null, /* notificationId= */ 0,
mEmergencyLocationUserNotification, UserHandle.ALL); createEmergencyLocationUserNotification(mContext), UserHandle.ALL);
} }
private static Notification createEmergencyLocationUserNotification(Context context) { private static Notification createEmergencyLocationUserNotification(Context context) {
String firstLineText = context.getString(R.string.gpsNotifTitle); // NOTE: Do not reuse the returned notification object as it will not reflect
String secondLineText = context.getString(R.string.global_action_emergency); // changes to notification text when the system language is changed.
String accessibilityServicesText = firstLineText + " (" + secondLineText + ")"; final String firstLineText = context.getString(R.string.gpsNotifTitle);
final String secondLineText = context.getString(R.string.global_action_emergency);
final String accessibilityServicesText = firstLineText + " (" + secondLineText + ")";
return new Notification.Builder(context, SystemNotificationChannels.NETWORK_ALERTS) return new Notification.Builder(context, SystemNotificationChannels.NETWORK_ALERTS)
.setSmallIcon(com.android.internal.R.drawable.stat_sys_gps_on) .setSmallIcon(com.android.internal.R.drawable.stat_sys_gps_on)
.setWhen(0) .setWhen(0)