Use same fallback bt name in Settings and notification.

Bug: 30126659
Change-Id: Id1432b459a4368bae9af6067307c4da0008f94aa
This commit is contained in:
Fan Zhang
2016-08-08 14:48:24 -07:00
parent 01f26e84f4
commit 97ca78975a
3 changed files with 15 additions and 12 deletions

View File

@@ -17,6 +17,7 @@
package com.android.settings.bluetooth;
import android.app.AlertDialog;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothProfile;
import android.content.Context;
import android.content.DialogInterface;
@@ -126,6 +127,15 @@ public final class Utils {
return LocalBluetoothManager.getInstance(context, mOnInitCallback);
}
public static String createRemoteName(Context context, BluetoothDevice device) {
String mRemoteName = device != null ? device.getAliasName() : null;
if (mRemoteName == null) {
mRemoteName = context.getString(R.string.unknown);
}
return mRemoteName;
}
private static final ErrorListener mErrorListener = new ErrorListener() {
@Override
public void onShowError(Context context, String name, int messageResId) {