private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
static class Static implements DisplayManager.DisplayListener {
- final Context mAppContext;
+ final String mPackageName;
final Resources mResources;
final IAudioService mAudioService;
final DisplayManager mDisplayService;
};
Static(Context appContext) {
- mAppContext = appContext;
- mResources = Resources.getSystem();
+ mPackageName = appContext.getPackageName();
+ mResources = appContext.getResources();
mHandler = new Handler(appContext.getMainLooper());
IBinder b = ServiceManager.getService(Context.AUDIO_SERVICE);
try {
Client client = new Client();
- mMediaRouterService.registerClientAsUser(client,
- mAppContext.getPackageName(), userId);
+ mMediaRouterService.registerClientAsUser(client, mPackageName, userId);
mClient = client;
} catch (RemoteException ex) {
Log.e(TAG, "Unable to register media router client.", ex);
CharSequence getName(Resources res) {
if (mNameResId != 0) {
- return mName = res.getText(mNameResId);
+ return res.getText(mNameResId);
}
return mName;
}
* @param name Name to display to the user to describe this route
*/
public void setName(CharSequence name) {
+ mNameResId = 0;
mName = name;
routeUpdated();
}
private void configureSessionVolume() {
if (mRcc == null) {
if (DEBUG) {
- Log.d(TAG, "No Rcc to configure volume for route " + mName);
+ Log.d(TAG, "No Rcc to configure volume for route " + getName());
}
return;
}
for (int i = 0; i < count; i++) {
final RouteInfo info = mRoutes.get(i);
// TODO: There's probably a much more correct way to localize this.
- if (i > 0) sb.append(", ");
- sb.append(info.mName);
+ if (i > 0) {
+ sb.append(", ");
+ }
+ sb.append(info.getName());
}
mName = sb.toString();
mUpdateName = false;
@Override
public String toString() {
- return "RouteCategory{ name=" + mName + " types=" + typesToString(mTypes) +
+ return "RouteCategory{ name=" + getName() + " types=" + typesToString(mTypes) +
" groupable=" + mGroupable + " }";
}
}