Merge "MediaRouter2: Make TAGs have common prefix 'MR2'"
This commit is contained in:
committed by
Android (Google) Code Review
commit
268294f394
@@ -369,7 +369,7 @@ public final class MediaRoute2Info implements Parcelable {
|
||||
@NonNull
|
||||
public Builder setProviderId(@NonNull String providerId) {
|
||||
if (TextUtils.isEmpty(providerId)) {
|
||||
throw new IllegalArgumentException("id must not be null or empty");
|
||||
throw new IllegalArgumentException("providerId must not be null or empty");
|
||||
}
|
||||
mProviderId = providerId;
|
||||
return this;
|
||||
|
||||
@@ -30,7 +30,7 @@ import android.util.Log;
|
||||
* @hide
|
||||
*/
|
||||
public abstract class MediaRoute2ProviderService extends Service {
|
||||
private static final String TAG = "MediaRouteProviderSrv";
|
||||
private static final String TAG = "MR2ProviderService";
|
||||
|
||||
public static final String SERVICE_INTERFACE = "android.media.MediaRoute2ProviderService";
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ import java.util.concurrent.Executor;
|
||||
* @hide
|
||||
*/
|
||||
public class MediaRouter2 {
|
||||
private static final String TAG = "MediaRouter";
|
||||
private static final String TAG = "MR2";
|
||||
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
|
||||
private static final Object sLock = new Object();
|
||||
|
||||
@@ -54,7 +54,8 @@ public class MediaRouter2 {
|
||||
private Context mContext;
|
||||
private final IMediaRouterService mMediaRouterService;
|
||||
|
||||
private CopyOnWriteArrayList<CallbackRecord> mCallbackRecords = new CopyOnWriteArrayList<>();
|
||||
private final CopyOnWriteArrayList<CallbackRecord> mCallbackRecords =
|
||||
new CopyOnWriteArrayList<>();
|
||||
@GuardedBy("sLock")
|
||||
private List<String> mControlCategories = Collections.emptyList();
|
||||
@GuardedBy("sLock")
|
||||
|
||||
@@ -46,7 +46,7 @@ import java.util.concurrent.Executor;
|
||||
* @hide
|
||||
*/
|
||||
public class MediaRouter2Manager {
|
||||
private static final String TAG = "MediaRouter2Manager";
|
||||
private static final String TAG = "MR2Manager";
|
||||
private static final Object sLock = new Object();
|
||||
|
||||
@GuardedBy("sLock")
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class SampleMediaRoute2ProviderService extends MediaRoute2ProviderService {
|
||||
private static final String TAG = "SampleMediaRoute2Serv";
|
||||
private static final String TAG = "SampleMR2ProviderSvc";
|
||||
|
||||
public static final String ROUTE_ID1 = "route_id1";
|
||||
public static final String ROUTE_NAME1 = "Sample Route 1";
|
||||
|
||||
@@ -43,7 +43,7 @@ import java.util.Objects;
|
||||
* Maintains a connection to a particular media route provider service.
|
||||
*/
|
||||
final class MediaRoute2ProviderProxy implements ServiceConnection {
|
||||
private static final String TAG = "MediaRoute2Provider";
|
||||
private static final String TAG = "MR2ProviderProxy";
|
||||
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
|
||||
|
||||
private final Context mContext;
|
||||
@@ -274,7 +274,9 @@ final class MediaRoute2ProviderProxy implements ServiceConnection {
|
||||
.setUniqueId(mUniqueId)
|
||||
.build();
|
||||
}
|
||||
mHandler.post(mStateChanged);
|
||||
if (mCallback != null) {
|
||||
mCallback.onProviderStateChanged(MediaRoute2ProviderProxy.this);
|
||||
}
|
||||
}
|
||||
|
||||
private void disconnect() {
|
||||
@@ -291,15 +293,6 @@ final class MediaRoute2ProviderProxy implements ServiceConnection {
|
||||
return "Service connection " + mComponentName.flattenToShortString();
|
||||
}
|
||||
|
||||
private final Runnable mStateChanged = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mCallback != null) {
|
||||
mCallback.onProviderStateChanged(MediaRoute2ProviderProxy.this);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public interface Callback {
|
||||
void onProviderStateChanged(MediaRoute2ProviderProxy provider);
|
||||
}
|
||||
|
||||
@@ -35,9 +35,10 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* Watches changes of packages, or scan them for finding media route providers.
|
||||
*/
|
||||
final class MediaRoute2ProviderWatcher {
|
||||
private static final String TAG = "MediaRouteProvider"; // max. 23 chars
|
||||
private static final String TAG = "MR2ProviderWatcher";
|
||||
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
|
||||
|
||||
private final Context mContext;
|
||||
|
||||
@@ -55,7 +55,7 @@ import java.util.Objects;
|
||||
* TODO: Merge this to MediaRouterService once it's finished.
|
||||
*/
|
||||
class MediaRouter2ServiceImpl {
|
||||
private static final String TAG = "MediaRouter2ServiceImpl";
|
||||
private static final String TAG = "MR2ServiceImpl";
|
||||
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
|
||||
|
||||
private final Context mContext;
|
||||
@@ -339,11 +339,11 @@ class MediaRouter2ServiceImpl {
|
||||
int uid, int pid, String packageName, int userId, boolean trusted) {
|
||||
final IBinder binder = client.asBinder();
|
||||
if (mAllClientRecords.get(binder) == null) {
|
||||
boolean newUser = false;
|
||||
UserRecord userRecord = mUserRecords.get(userId);
|
||||
if (userRecord == null) {
|
||||
userRecord = new UserRecord(userId);
|
||||
newUser = true;
|
||||
mUserRecords.put(userId, userRecord);
|
||||
initializeUserLocked(userRecord);
|
||||
}
|
||||
Client2Record clientRecord = new Client2Record(userRecord, client, uid, pid,
|
||||
packageName, trusted);
|
||||
@@ -353,11 +353,6 @@ class MediaRouter2ServiceImpl {
|
||||
throw new RuntimeException("Media router client died prematurely.", ex);
|
||||
}
|
||||
|
||||
if (newUser) {
|
||||
mUserRecords.put(userId, userRecord);
|
||||
initializeUserLocked(userRecord);
|
||||
}
|
||||
|
||||
userRecord.mClientRecords.add(clientRecord);
|
||||
mAllClientRecords.put(binder, clientRecord);
|
||||
|
||||
@@ -815,8 +810,6 @@ class MediaRouter2ServiceImpl {
|
||||
if (service == null) {
|
||||
return;
|
||||
}
|
||||
final List<IMediaRouter2Manager> managers = new ArrayList<>();
|
||||
final List<IMediaRouter2Client> clients = new ArrayList<>();
|
||||
final List<MediaRoute2ProviderInfo> providers = new ArrayList<>();
|
||||
for (MediaRoute2ProviderProxy mediaProvider : mMediaProviders) {
|
||||
final MediaRoute2ProviderInfo providerInfo =
|
||||
@@ -829,6 +822,8 @@ class MediaRouter2ServiceImpl {
|
||||
}
|
||||
mProviderInfos = providers;
|
||||
|
||||
final List<IMediaRouter2Manager> managers = new ArrayList<>();
|
||||
final List<IMediaRouter2Client> clients = new ArrayList<>();
|
||||
synchronized (service.mLock) {
|
||||
for (ManagerRecord managerRecord : mUserRecord.mManagerRecords) {
|
||||
managers.add(managerRecord.mManager);
|
||||
@@ -878,9 +873,8 @@ class MediaRouter2ServiceImpl {
|
||||
}
|
||||
List<IMediaRouter2Manager> managers = new ArrayList<>();
|
||||
synchronized (service.mLock) {
|
||||
final int count = mUserRecord.mManagerRecords.size();
|
||||
for (int i = 0; i < count; i++) {
|
||||
managers.add(mUserRecord.mManagerRecords.get(i).mManager);
|
||||
for (ManagerRecord managerRecord : mUserRecord.mManagerRecords) {
|
||||
managers.add(managerRecord.mManager);
|
||||
}
|
||||
}
|
||||
for (IMediaRouter2Manager manager : managers) {
|
||||
|
||||
Reference in New Issue
Block a user