Loading core/java/com/android/internal/app/IAppOpsService.aidl +6 −2 Original line number Diff line number Diff line Loading @@ -26,8 +26,9 @@ import com.android.internal.app.IAppOpsActiveCallback; import com.android.internal.app.IAppOpsNotedCallback; interface IAppOpsService { // These first methods are also called by native code, so must // These methods are also called by native code, so must // be kept in sync with frameworks/native/libs/binder/include/binder/IAppOpsService.h // and not be reordered int checkOperation(int code, int uid, String packageName); int noteOperation(int code, int uid, String packageName); int startOperation(IBinder token, int code, int uid, String packageName, Loading @@ -38,6 +39,10 @@ interface IAppOpsService { void stopWatchingMode(IAppOpsCallback callback); IBinder getToken(IBinder clientToken); int permissionToOpCode(String permission); int checkAudioOperation(int code, int usage, int uid, String packageName); // End of methods also called by native code. // Any new method exposed to native must be added after the last one, do not reorder int noteProxyOperation(int code, int proxyUid, String proxyPackageName, int callingUid, String callingPackageName); Loading @@ -62,7 +67,6 @@ interface IAppOpsService { void setMode(int code, int uid, String packageName, int mode); @UnsupportedAppUsage void resetAllModes(int reqUserId, String reqPackageName); int checkAudioOperation(int code, int usage, int uid, String packageName); void setAudioRestriction(int code, int usage, int uid, int mode, in String[] exceptionPackages); void setUserRestrictions(in Bundle restrictions, IBinder token, int userHandle); Loading media/java/android/media/AudioPlaybackConfiguration.java +0 −2 Original line number Diff line number Diff line Loading @@ -43,8 +43,6 @@ public final class AudioPlaybackConfiguration implements Parcelable { /** @hide */ public static final int PLAYER_PIID_INVALID = -1; /** @hide */ public static final int PLAYER_PIID_UNASSIGNED = 0; /** @hide */ public static final int PLAYER_UPID_INVALID = -1; // information about the implementation Loading media/java/android/media/PlayerBase.java +27 −17 Original line number Diff line number Diff line Loading @@ -50,6 +50,10 @@ public abstract class PlayerBase { private static final boolean DEBUG = DEBUG_APP_OPS || false; private static IAudioService sService; //lazy initialization, use getService() /** if true, only use OP_PLAY_AUDIO monitoring for logging, and rely on muting to happen * in AudioFlinger */ private static final boolean USE_AUDIOFLINGER_MUTING_FOR_OP = true; // parameters of the player that affect AppOps protected AudioAttributes mAttributes; Loading @@ -67,13 +71,13 @@ public abstract class PlayerBase { // for AppOps private @Nullable IAppOpsService mAppOps; private IAppOpsCallback mAppOpsCallback; private @Nullable IAppOpsCallback mAppOpsCallback; @GuardedBy("mLock") private boolean mHasAppOpsPlayAudio = true; private final int mImplType; // uniquely identifies the Player Interface throughout the system (P I Id) private int mPlayerIId = AudioPlaybackConfiguration.PLAYER_PIID_UNASSIGNED; private int mPlayerIId = AudioPlaybackConfiguration.PLAYER_PIID_INVALID; @GuardedBy("mLock") private int mState; Loading Loading @@ -104,7 +108,7 @@ public abstract class PlayerBase { * Call from derived class when instantiation / initialization is successful */ protected void baseRegisterPlayer() { int newPiid = AudioPlaybackConfiguration.PLAYER_PIID_INVALID; if (!USE_AUDIOFLINGER_MUTING_FOR_OP) { IBinder b = ServiceManager.getService(Context.APP_OPS_SERVICE); mAppOps = IAppOpsService.Stub.asInterface(b); // initialize mHasAppOpsPlayAudio Loading @@ -118,13 +122,13 @@ public abstract class PlayerBase { Log.e(TAG, "Error registering appOps callback", e); mHasAppOpsPlayAudio = false; } } try { newPiid = getService().trackPlayer( mPlayerIId = getService().trackPlayer( new PlayerIdCard(mImplType, mAttributes, new IPlayerWrapper(this))); } catch (RemoteException e) { Log.e(TAG, "Error talking to audio service, player will not be tracked", e); } mPlayerIId = newPiid; } /** Loading Loading @@ -284,6 +288,9 @@ public abstract class PlayerBase { * Must be called synchronized on mLock. */ void updateAppOpsPlayAudio_sync(boolean attributesChanged) { if (USE_AUDIOFLINGER_MUTING_FOR_OP) { return; } boolean oldHasAppOpsPlayAudio = mHasAppOpsPlayAudio; try { int mode = AppOpsManager.MODE_IGNORED; Loading Loading @@ -333,6 +340,9 @@ public abstract class PlayerBase { * @return */ boolean isRestricted_sync() { if (USE_AUDIOFLINGER_MUTING_FOR_OP) { return false; } // check app ops if (mHasAppOpsPlayAudio) { return false; Loading Loading
core/java/com/android/internal/app/IAppOpsService.aidl +6 −2 Original line number Diff line number Diff line Loading @@ -26,8 +26,9 @@ import com.android.internal.app.IAppOpsActiveCallback; import com.android.internal.app.IAppOpsNotedCallback; interface IAppOpsService { // These first methods are also called by native code, so must // These methods are also called by native code, so must // be kept in sync with frameworks/native/libs/binder/include/binder/IAppOpsService.h // and not be reordered int checkOperation(int code, int uid, String packageName); int noteOperation(int code, int uid, String packageName); int startOperation(IBinder token, int code, int uid, String packageName, Loading @@ -38,6 +39,10 @@ interface IAppOpsService { void stopWatchingMode(IAppOpsCallback callback); IBinder getToken(IBinder clientToken); int permissionToOpCode(String permission); int checkAudioOperation(int code, int usage, int uid, String packageName); // End of methods also called by native code. // Any new method exposed to native must be added after the last one, do not reorder int noteProxyOperation(int code, int proxyUid, String proxyPackageName, int callingUid, String callingPackageName); Loading @@ -62,7 +67,6 @@ interface IAppOpsService { void setMode(int code, int uid, String packageName, int mode); @UnsupportedAppUsage void resetAllModes(int reqUserId, String reqPackageName); int checkAudioOperation(int code, int usage, int uid, String packageName); void setAudioRestriction(int code, int usage, int uid, int mode, in String[] exceptionPackages); void setUserRestrictions(in Bundle restrictions, IBinder token, int userHandle); Loading
media/java/android/media/AudioPlaybackConfiguration.java +0 −2 Original line number Diff line number Diff line Loading @@ -43,8 +43,6 @@ public final class AudioPlaybackConfiguration implements Parcelable { /** @hide */ public static final int PLAYER_PIID_INVALID = -1; /** @hide */ public static final int PLAYER_PIID_UNASSIGNED = 0; /** @hide */ public static final int PLAYER_UPID_INVALID = -1; // information about the implementation Loading
media/java/android/media/PlayerBase.java +27 −17 Original line number Diff line number Diff line Loading @@ -50,6 +50,10 @@ public abstract class PlayerBase { private static final boolean DEBUG = DEBUG_APP_OPS || false; private static IAudioService sService; //lazy initialization, use getService() /** if true, only use OP_PLAY_AUDIO monitoring for logging, and rely on muting to happen * in AudioFlinger */ private static final boolean USE_AUDIOFLINGER_MUTING_FOR_OP = true; // parameters of the player that affect AppOps protected AudioAttributes mAttributes; Loading @@ -67,13 +71,13 @@ public abstract class PlayerBase { // for AppOps private @Nullable IAppOpsService mAppOps; private IAppOpsCallback mAppOpsCallback; private @Nullable IAppOpsCallback mAppOpsCallback; @GuardedBy("mLock") private boolean mHasAppOpsPlayAudio = true; private final int mImplType; // uniquely identifies the Player Interface throughout the system (P I Id) private int mPlayerIId = AudioPlaybackConfiguration.PLAYER_PIID_UNASSIGNED; private int mPlayerIId = AudioPlaybackConfiguration.PLAYER_PIID_INVALID; @GuardedBy("mLock") private int mState; Loading Loading @@ -104,7 +108,7 @@ public abstract class PlayerBase { * Call from derived class when instantiation / initialization is successful */ protected void baseRegisterPlayer() { int newPiid = AudioPlaybackConfiguration.PLAYER_PIID_INVALID; if (!USE_AUDIOFLINGER_MUTING_FOR_OP) { IBinder b = ServiceManager.getService(Context.APP_OPS_SERVICE); mAppOps = IAppOpsService.Stub.asInterface(b); // initialize mHasAppOpsPlayAudio Loading @@ -118,13 +122,13 @@ public abstract class PlayerBase { Log.e(TAG, "Error registering appOps callback", e); mHasAppOpsPlayAudio = false; } } try { newPiid = getService().trackPlayer( mPlayerIId = getService().trackPlayer( new PlayerIdCard(mImplType, mAttributes, new IPlayerWrapper(this))); } catch (RemoteException e) { Log.e(TAG, "Error talking to audio service, player will not be tracked", e); } mPlayerIId = newPiid; } /** Loading Loading @@ -284,6 +288,9 @@ public abstract class PlayerBase { * Must be called synchronized on mLock. */ void updateAppOpsPlayAudio_sync(boolean attributesChanged) { if (USE_AUDIOFLINGER_MUTING_FOR_OP) { return; } boolean oldHasAppOpsPlayAudio = mHasAppOpsPlayAudio; try { int mode = AppOpsManager.MODE_IGNORED; Loading Loading @@ -333,6 +340,9 @@ public abstract class PlayerBase { * @return */ boolean isRestricted_sync() { if (USE_AUDIOFLINGER_MUTING_FOR_OP) { return false; } // check app ops if (mHasAppOpsPlayAudio) { return false; Loading