Merge "MediaResourceMonitor: Change argument type from string to int" into nyc-dev
am: 7b0864c
* commit '7b0864cc68c3579045bed3bcabe907a81b674bf0':
MediaResourceMonitor: Change argument type from string to int
This commit is contained in:
@@ -19,6 +19,6 @@ package android.media;
|
|||||||
/** {@hide} */
|
/** {@hide} */
|
||||||
interface IMediaResourceMonitor
|
interface IMediaResourceMonitor
|
||||||
{
|
{
|
||||||
oneway void notifyResourceGranted(in int pid, String type, String subType, long value);
|
oneway void notifyResourceGranted(in int pid, in int type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,13 +37,6 @@ public class MediaResourceMonitorService extends SystemService {
|
|||||||
|
|
||||||
private static final String SERVICE_NAME = "media_resource_monitor";
|
private static final String SERVICE_NAME = "media_resource_monitor";
|
||||||
|
|
||||||
/*
|
|
||||||
* Resource types. Should be in sync with:
|
|
||||||
* frameworks/av/media/libmedia/MediaResource.cpp
|
|
||||||
*/
|
|
||||||
private static final String RESOURCE_AUDIO_CODEC = "audio-codec";
|
|
||||||
private static final String RESOURCE_VIDEO_CODEC = "video-codec";
|
|
||||||
|
|
||||||
private final MediaResourceMonitorImpl mMediaResourceMonitorImpl;
|
private final MediaResourceMonitorImpl mMediaResourceMonitorImpl;
|
||||||
|
|
||||||
public MediaResourceMonitorService(Context context) {
|
public MediaResourceMonitorService(Context context) {
|
||||||
@@ -58,25 +51,18 @@ public class MediaResourceMonitorService extends SystemService {
|
|||||||
|
|
||||||
class MediaResourceMonitorImpl extends IMediaResourceMonitor.Stub {
|
class MediaResourceMonitorImpl extends IMediaResourceMonitor.Stub {
|
||||||
@Override
|
@Override
|
||||||
public void notifyResourceGranted(int pid, String type, String subType, long value)
|
public void notifyResourceGranted(int pid, int type)
|
||||||
throws RemoteException {
|
throws RemoteException {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Slog.d(TAG, "notifyResourceGranted(pid=" + pid + ", type=" + type + ", subType="
|
Slog.d(TAG, "notifyResourceGranted(pid=" + pid + ", type=" + type + ")");
|
||||||
+ subType + ", value=" + value + ")");
|
|
||||||
}
|
}
|
||||||
final long identity = Binder.clearCallingIdentity();
|
final long identity = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
String pkgNames[] = getPackageNamesFromPid(pid);
|
String pkgNames[] = getPackageNamesFromPid(pid);
|
||||||
Integer resourceType = null;
|
if (pkgNames != null) {
|
||||||
if (RESOURCE_AUDIO_CODEC.equals(subType)) {
|
|
||||||
resourceType = Intent.EXTRA_MEDIA_RESOURCE_TYPE_AUDIO_CODEC;
|
|
||||||
} else if (RESOURCE_VIDEO_CODEC.equals(subType)) {
|
|
||||||
resourceType = Intent.EXTRA_MEDIA_RESOURCE_TYPE_VIDEO_CODEC;
|
|
||||||
}
|
|
||||||
if (pkgNames != null && resourceType != null) {
|
|
||||||
Intent intent = new Intent(Intent.ACTION_MEDIA_RESOURCE_GRANTED);
|
Intent intent = new Intent(Intent.ACTION_MEDIA_RESOURCE_GRANTED);
|
||||||
intent.putExtra(Intent.EXTRA_PACKAGES, pkgNames);
|
intent.putExtra(Intent.EXTRA_PACKAGES, pkgNames);
|
||||||
intent.putExtra(Intent.EXTRA_MEDIA_RESOURCE_TYPE, resourceType);
|
intent.putExtra(Intent.EXTRA_MEDIA_RESOURCE_TYPE, type);
|
||||||
getContext().sendBroadcastAsUser(intent,
|
getContext().sendBroadcastAsUser(intent,
|
||||||
new UserHandle(ActivityManager.getCurrentUser()),
|
new UserHandle(ActivityManager.getCurrentUser()),
|
||||||
android.Manifest.permission.RECEIVE_MEDIA_RESOURCE_USAGE);
|
android.Manifest.permission.RECEIVE_MEDIA_RESOURCE_USAGE);
|
||||||
|
|||||||
Reference in New Issue
Block a user