Merge "Fix misleading phrasing of notification message for crashed phone apps and show phone app name in notification." am: 3cc519dc4a
Change-Id: If2ab53707b4d8d67fdd55118cd154cfaa4de3387
This commit is contained in:
commit
1b2f0987cf
|
@ -73,8 +73,8 @@
|
||||||
<string name="notification_crashedInCallService_title">Crashed phone app</string>
|
<string name="notification_crashedInCallService_title">Crashed phone app</string>
|
||||||
<!-- Body of the notification presented when an in call service crashed. [CHAR LIMIT=NONE] -->
|
<!-- Body of the notification presented when an in call service crashed. [CHAR LIMIT=NONE] -->
|
||||||
<string name="notification_crashedInCallService_body">
|
<string name="notification_crashedInCallService_body">
|
||||||
Your Phone app <xliff:g id="in_call_service_app_name">%s</xliff:g> has crashed.
|
Your phone app <xliff:g id="in_call_service_app_name">%s</xliff:g> has crashed.
|
||||||
You call was continued using the Phone app that came with your device.
|
You call was continued using the phone app that came with your device.
|
||||||
</string>
|
</string>
|
||||||
|
|
||||||
<!-- Content description of the call muted notification icon for
|
<!-- Content description of the call muted notification icon for
|
||||||
|
|
|
@ -24,6 +24,7 @@ import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.ServiceConnection;
|
import android.content.ServiceConnection;
|
||||||
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
import android.content.pm.ServiceInfo;
|
import android.content.pm.ServiceInfo;
|
||||||
|
@ -1804,6 +1805,17 @@ public class InCallController extends CallsManagerListenerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendCrashedInCallServiceNotification(String packageName) {
|
private void sendCrashedInCallServiceNotification(String packageName) {
|
||||||
|
PackageManager packageManager = mContext.getPackageManager();
|
||||||
|
CharSequence appName;
|
||||||
|
try {
|
||||||
|
appName = packageManager.getApplicationLabel(
|
||||||
|
packageManager.getApplicationInfo(packageName, 0));
|
||||||
|
if (TextUtils.isEmpty(appName)) {
|
||||||
|
appName = packageName;
|
||||||
|
}
|
||||||
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
|
appName = packageName;
|
||||||
|
}
|
||||||
NotificationManager notificationManager = (NotificationManager) mContext
|
NotificationManager notificationManager = (NotificationManager) mContext
|
||||||
.getSystemService(Context.NOTIFICATION_SERVICE);
|
.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
Notification.Builder builder = new Notification.Builder(mContext,
|
Notification.Builder builder = new Notification.Builder(mContext,
|
||||||
|
@ -1816,7 +1828,7 @@ public class InCallController extends CallsManagerListenerBase {
|
||||||
.setStyle(new Notification.BigTextStyle()
|
.setStyle(new Notification.BigTextStyle()
|
||||||
.bigText(mContext.getString(
|
.bigText(mContext.getString(
|
||||||
R.string.notification_crashedInCallService_body,
|
R.string.notification_crashedInCallService_body,
|
||||||
packageName)));
|
appName)));
|
||||||
notificationManager.notify(NOTIFICATION_TAG, IN_CALL_SERVICE_NOTIFICATION_ID,
|
notificationManager.notify(NOTIFICATION_TAG, IN_CALL_SERVICE_NOTIFICATION_ID,
|
||||||
builder.build());
|
builder.build());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue