diff options
author | Jorim Jaggi <jjaggi@google.com> | 2015-04-15 15:11:48 -0700 |
---|---|---|
committer | Jorim Jaggi <jjaggi@google.com> | 2015-04-15 15:41:07 -0700 |
commit | b09f8e29dd7d45b2044c3c75fa40e3b31c5d2cfa (patch) | |
tree | c7aed94a41d7743872bed3c69a35dd689e7dd01b /services/voiceinteraction | |
parent | 2aad7ee245857a46aae305fefc4e3c1bcdd4a586 (diff) | |
download | frameworks_base-b09f8e29dd7d45b2044c3c75fa40e3b31c5d2cfa.zip frameworks_base-b09f8e29dd7d45b2044c3c75fa40e3b31c5d2cfa.tar.gz frameworks_base-b09f8e29dd7d45b2044c3c75fa40e3b31c5d2cfa.tar.bz2 |
Fix VoiceInteraction permission issues
Change-Id: Id3796066353a6d7799ae983d18e6adc38c8cef52
Diffstat (limited to 'services/voiceinteraction')
3 files changed, 9 insertions, 21 deletions
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java index 8a28d51..7dce83e 100644 --- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java +++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java @@ -393,12 +393,9 @@ public class VoiceInteractionManagerService extends SystemService { throw new SecurityException( "Caller is not the current voice interaction service"); } - final int callingPid = Binder.getCallingPid(); - final int callingUid = Binder.getCallingUid(); final long caller = Binder.clearCallingIdentity(); try { - mImpl.showSessionLocked(callingPid, callingUid, args, flags, - null /* showCallback */); + mImpl.showSessionLocked(args, flags, null /* showCallback */); } finally { Binder.restoreCallingIdentity(caller); } @@ -432,12 +429,9 @@ public class VoiceInteractionManagerService extends SystemService { Slog.w(TAG, "showSessionFromSession without running voice interaction service"); return false; } - final int callingPid = Binder.getCallingPid(); - final int callingUid = Binder.getCallingUid(); final long caller = Binder.clearCallingIdentity(); try { - return mImpl.showSessionLocked(callingPid, callingUid, sessionArgs, flags, - null /* showCallback */); + return mImpl.showSessionLocked(sessionArgs, flags, null /* showCallback */); } finally { Binder.restoreCallingIdentity(caller); } @@ -506,11 +500,9 @@ public class VoiceInteractionManagerService extends SystemService { Slog.w(TAG, "finish without running voice interaction service"); return; } - final int callingPid = Binder.getCallingPid(); - final int callingUid = Binder.getCallingUid(); final long caller = Binder.clearCallingIdentity(); try { - mImpl.finishLocked(callingPid, callingUid, token); + mImpl.finishLocked(token); } finally { Binder.restoreCallingIdentity(caller); } @@ -708,11 +700,9 @@ public class VoiceInteractionManagerService extends SystemService { + "service"); return; } - final int callingPid = Binder.getCallingPid(); - final int callingUid = Binder.getCallingUid(); final long caller = Binder.clearCallingIdentity(); try { - mImpl.showSessionLocked(callingPid, callingUid, new Bundle() /* sessionArgs */, + mImpl.showSessionLocked(new Bundle() /* sessionArgs */, VoiceInteractionService.START_SOURCE_ASSIST_GESTURE | VoiceInteractionService.START_WITH_ASSIST | VoiceInteractionService.START_WITH_SCREENSHOT, diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java index bca757b..61ec162 100644 --- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java +++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java @@ -135,11 +135,11 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne mContext.registerReceiver(mBroadcastReceiver, filter, null, handler); } - public boolean showSessionLocked(int callingPid, int callingUid, Bundle args, int flags, + public boolean showSessionLocked(Bundle args, int flags, IVoiceInteractionSessionShowCallback showCallback) { if (mActiveSession == null) { mActiveSession = new VoiceInteractionSessionConnection(mLock, mSessionComponentName, - mUser, mContext, this, callingPid, callingUid); + mUser, mContext, this, mInfo.getServiceInfo().applicationInfo.uid); } return mActiveSession.showLocked(args, flags, showCallback); } @@ -196,7 +196,7 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne } } - public void finishLocked(int callingPid, int callingUid, IBinder token) { + public void finishLocked(IBinder token) { if (mActiveSession == null || token != mActiveSession.mToken) { Slog.w(TAG, "finish does not match active session"); return; @@ -267,7 +267,7 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne @Override public void sessionConnectionGone(VoiceInteractionSessionConnection connection) { synchronized (mLock) { - finishLocked(connection.mCallingPid, connection.mCallingUid, connection.mToken); + finishLocked(connection.mToken); } } } diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java index fb83956..9634ab8 100644 --- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java +++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java @@ -59,7 +59,6 @@ final class VoiceInteractionSessionConnection implements ServiceConnection { final int mUser; final Context mContext; final Callback mCallback; - final int mCallingPid; final int mCallingUid; final IActivityManager mAm; final IWindowManager mIWindowManager; @@ -139,13 +138,12 @@ final class VoiceInteractionSessionConnection implements ServiceConnection { }; public VoiceInteractionSessionConnection(Object lock, ComponentName component, int user, - Context context, Callback callback, int callingPid, int callingUid) { + Context context, Callback callback, int callingUid) { mLock = lock; mSessionComponentName = component; mUser = user; mContext = context; mCallback = callback; - mCallingPid = callingPid; mCallingUid = callingUid; mAm = ActivityManagerNative.getDefault(); mIWindowManager = IWindowManager.Stub.asInterface( |