diff options
author | Christoph Studer <chstuder@google.com> | 2014-04-16 17:37:19 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-04-16 17:37:20 +0000 |
commit | d67d073b9fd110e6b9dfa6af11e8655dcc69f6ef (patch) | |
tree | e57640eb2168235a6a25cdcb22d481517b78196d | |
parent | fe08369d8cd575f1f1db38f57be4c2a960f4a856 (diff) | |
parent | 8fd7f1ed7c11d35b3f2a97878e68ee38a551dd15 (diff) | |
download | frameworks_base-d67d073b9fd110e6b9dfa6af11e8655dcc69f6ef.zip frameworks_base-d67d073b9fd110e6b9dfa6af11e8655dcc69f6ef.tar.gz frameworks_base-d67d073b9fd110e6b9dfa6af11e8655dcc69f6ef.tar.bz2 |
Merge "Rename basePkg to opPkg"
9 files changed, 47 insertions, 52 deletions
diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl index 9911467..bb6eeda 100644 --- a/core/java/android/app/INotificationManager.aidl +++ b/core/java/android/app/INotificationManager.aidl @@ -31,7 +31,7 @@ interface INotificationManager void enqueueToast(String pkg, ITransientNotification callback, int duration); void cancelToast(String pkg, ITransientNotification callback); - void enqueueNotificationWithTag(String pkg, String basePkg, String tag, int id, + void enqueueNotificationWithTag(String pkg, String opPkg, String tag, int id, in Notification notification, inout int[] idReceived, int userId); void cancelNotificationWithTag(String pkg, String tag, int id, int userId); diff --git a/core/java/android/hardware/input/InputManager.java b/core/java/android/hardware/input/InputManager.java index 0c0dfe9..b5efa8e 100644 --- a/core/java/android/hardware/input/InputManager.java +++ b/core/java/android/hardware/input/InputManager.java @@ -857,7 +857,7 @@ public final class InputManager { * @hide */ @Override - public void vibrate(int owningUid, String owningPackage, long milliseconds, + public void vibrate(int uid, String opPkg, long milliseconds, int streamHint) { vibrate(new long[] { 0, milliseconds}, -1); } @@ -866,7 +866,7 @@ public final class InputManager { * @hide */ @Override - public void vibrate(int owningUid, String owningPackage, long[] pattern, int repeat, + public void vibrate(int uid, String opPkg, long[] pattern, int repeat, int streamHint) { if (repeat >= pattern.length) { throw new ArrayIndexOutOfBoundsException(); diff --git a/core/java/android/os/IVibratorService.aidl b/core/java/android/os/IVibratorService.aidl index 4854bc0..4d05e2d 100644 --- a/core/java/android/os/IVibratorService.aidl +++ b/core/java/android/os/IVibratorService.aidl @@ -20,8 +20,8 @@ package android.os; interface IVibratorService { boolean hasVibrator(); - void vibrate(int uid, String packageName, long milliseconds, int streamHint, IBinder token); - void vibratePattern(int uid, String packageName, in long[] pattern, int repeat, int streamHint, IBinder token); + void vibrate(int uid, String opPkg, long milliseconds, int streamHint, IBinder token); + void vibratePattern(int uid, String opPkg, in long[] pattern, int repeat, int streamHint, IBinder token); void cancelVibrate(IBinder token); } diff --git a/core/java/android/os/NullVibrator.java b/core/java/android/os/NullVibrator.java index 536da32..7b870ac 100644 --- a/core/java/android/os/NullVibrator.java +++ b/core/java/android/os/NullVibrator.java @@ -40,7 +40,7 @@ public class NullVibrator extends Vibrator { * @hide */ @Override - public void vibrate(int owningUid, String owningPackage, long milliseconds, int streamHint) { + public void vibrate(int uid, String opPkg, long milliseconds, int streamHint) { vibrate(milliseconds); } @@ -48,7 +48,7 @@ public class NullVibrator extends Vibrator { * @hide */ @Override - public void vibrate(int owningUid, String owningPackage, long[] pattern, int repeat, + public void vibrate(int uid, String opPkg, long[] pattern, int repeat, int streamHint) { if (repeat >= pattern.length) { throw new ArrayIndexOutOfBoundsException(); diff --git a/core/java/android/os/SystemVibrator.java b/core/java/android/os/SystemVibrator.java index 13bc4f6..8d9cf54 100644 --- a/core/java/android/os/SystemVibrator.java +++ b/core/java/android/os/SystemVibrator.java @@ -58,13 +58,13 @@ public class SystemVibrator extends Vibrator { * @hide */ @Override - public void vibrate(int owningUid, String owningPackage, long milliseconds, int streamHint) { + public void vibrate(int uid, String opPkg, long milliseconds, int streamHint) { if (mService == null) { Log.w(TAG, "Failed to vibrate; no vibrator service."); return; } try { - mService.vibrate(owningUid, owningPackage, milliseconds, streamHint, mToken); + mService.vibrate(uid, opPkg, milliseconds, streamHint, mToken); } catch (RemoteException e) { Log.w(TAG, "Failed to vibrate.", e); } @@ -74,7 +74,7 @@ public class SystemVibrator extends Vibrator { * @hide */ @Override - public void vibrate(int owningUid, String owningPackage, long[] pattern, int repeat, + public void vibrate(int uid, String opPkg, long[] pattern, int repeat, int streamHint) { if (mService == null) { Log.w(TAG, "Failed to vibrate; no vibrator service."); @@ -85,7 +85,7 @@ public class SystemVibrator extends Vibrator { // anyway if (repeat < pattern.length) { try { - mService.vibratePattern(owningUid, owningPackage, pattern, repeat, streamHint, + mService.vibratePattern(uid, opPkg, pattern, repeat, streamHint, mToken); } catch (RemoteException e) { Log.w(TAG, "Failed to vibrate.", e); diff --git a/core/java/android/os/Vibrator.java b/core/java/android/os/Vibrator.java index 8845ba3..c1d4d4c 100644 --- a/core/java/android/os/Vibrator.java +++ b/core/java/android/os/Vibrator.java @@ -135,7 +135,7 @@ public abstract class Vibrator { * Like {@link #vibrate(long, int)}, but allowing the caller to specify that * the vibration is owned by someone else. */ - public abstract void vibrate(int owningUid, String owningPackage, + public abstract void vibrate(int uid, String opPkg, long milliseconds, int streamHint); /** @@ -143,7 +143,7 @@ public abstract class Vibrator { * Like {@link #vibrate(long[], int, int)}, but allowing the caller to specify that * the vibration is owned by someone else. */ - public abstract void vibrate(int owningUid, String owningPackage, + public abstract void vibrate(int uid, String opPkg, long[] pattern, int repeat, int streamHint); /** diff --git a/core/java/android/service/notification/StatusBarNotification.java b/core/java/android/service/notification/StatusBarNotification.java index 0f74169..2c0b76d 100644 --- a/core/java/android/service/notification/StatusBarNotification.java +++ b/core/java/android/service/notification/StatusBarNotification.java @@ -32,7 +32,7 @@ public class StatusBarNotification implements Parcelable { private final String key; private final int uid; - private final String basePkg; + private final String opPkg; private final int initialPid; private final Notification notification; private final UserHandle user; @@ -41,26 +41,20 @@ public class StatusBarNotification implements Parcelable { private final int score; /** @hide */ - public StatusBarNotification(String pkg, int id, String tag, int uid, int initialPid, int score, - Notification notification, UserHandle user) { - this(pkg, null, id, tag, uid, initialPid, score, notification, user); - } - - /** @hide */ - public StatusBarNotification(String pkg, String basePkg, int id, String tag, int uid, + public StatusBarNotification(String pkg, String opPkg, int id, String tag, int uid, int initialPid, int score, Notification notification, UserHandle user) { - this(pkg, basePkg, id, tag, uid, initialPid, score, notification, user, + this(pkg, opPkg, id, tag, uid, initialPid, score, notification, user, System.currentTimeMillis()); } - public StatusBarNotification(String pkg, String basePkg, int id, String tag, int uid, + public StatusBarNotification(String pkg, String opPkg, int id, String tag, int uid, int initialPid, int score, Notification notification, UserHandle user, long postTime) { if (pkg == null) throw new NullPointerException(); if (notification == null) throw new NullPointerException(); this.pkg = pkg; - this.basePkg = pkg; + this.opPkg = opPkg; this.id = id; this.tag = tag; this.uid = uid; @@ -75,7 +69,7 @@ public class StatusBarNotification implements Parcelable { public StatusBarNotification(Parcel in) { this.pkg = in.readString(); - this.basePkg = in.readString(); + this.opPkg = in.readString(); this.id = in.readInt(); if (in.readInt() != 0) { this.tag = in.readString(); @@ -93,12 +87,12 @@ public class StatusBarNotification implements Parcelable { } private String key() { - return pkg + '|' + basePkg + '|' + id + '|' + tag + '|' + uid; + return pkg + '|' + opPkg + '|' + id + '|' + tag + '|' + uid; } public void writeToParcel(Parcel out, int flags) { out.writeString(this.pkg); - out.writeString(this.basePkg); + out.writeString(this.opPkg); out.writeInt(this.id); if (this.tag != null) { out.writeInt(1); @@ -139,14 +133,14 @@ public class StatusBarNotification implements Parcelable { public StatusBarNotification cloneLight() { final Notification no = new Notification(); this.notification.cloneInto(no, false); // light copy - return new StatusBarNotification(this.pkg, this.basePkg, + return new StatusBarNotification(this.pkg, this.opPkg, this.id, this.tag, this.uid, this.initialPid, this.score, no, this.user, this.postTime); } @Override public StatusBarNotification clone() { - return new StatusBarNotification(this.pkg, this.basePkg, + return new StatusBarNotification(this.pkg, this.opPkg, this.id, this.tag, this.uid, this.initialPid, this.score, this.notification.clone(), this.user, this.postTime); } @@ -205,9 +199,9 @@ public class StatusBarNotification implements Parcelable { return uid; } - /** The notifying app's base package. @hide */ - public String getBasePkg() { - return basePkg; + /** The package used for AppOps tracking. @hide */ + public String getOpPkg() { + return opPkg; } /** @hide */ diff --git a/services/core/java/com/android/server/VibratorService.java b/services/core/java/com/android/server/VibratorService.java index aa756a1..132ca00 100644 --- a/services/core/java/com/android/server/VibratorService.java +++ b/services/core/java/com/android/server/VibratorService.java @@ -86,19 +86,19 @@ public class VibratorService extends IVibratorService.Stub private final int mRepeat; private final int mStreamHint; private final int mUid; - private final String mPackageName; + private final String mOpPkg; - Vibration(IBinder token, long millis, int streamHint, int uid, String packageName) { - this(token, millis, null, 0, streamHint, uid, packageName); + Vibration(IBinder token, long millis, int streamHint, int uid, String opPkg) { + this(token, millis, null, 0, streamHint, uid, opPkg); } Vibration(IBinder token, long[] pattern, int repeat, int streamHint, int uid, - String packageName) { - this(token, 0, pattern, repeat, streamHint, uid, packageName); + String opPkg) { + this(token, 0, pattern, repeat, streamHint, uid, opPkg); } private Vibration(IBinder token, long millis, long[] pattern, - int repeat, int streamHint, int uid, String packageName) { + int repeat, int streamHint, int uid, String opPkg) { mToken = token; mTimeout = millis; mStartTime = SystemClock.uptimeMillis(); @@ -106,7 +106,7 @@ public class VibratorService extends IVibratorService.Stub mRepeat = repeat; mStreamHint = streamHint; mUid = uid; - mPackageName = packageName; + mOpPkg = opPkg; } public void binderDied() { @@ -194,7 +194,7 @@ public class VibratorService extends IVibratorService.Stub Binder.getCallingPid(), Binder.getCallingUid(), null); } - public void vibrate(int uid, String packageName, long milliseconds, int streamHint, + public void vibrate(int uid, String opPkg, long milliseconds, int streamHint, IBinder token) { if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.VIBRATE) != PackageManager.PERMISSION_GRANTED) { @@ -211,7 +211,7 @@ public class VibratorService extends IVibratorService.Stub return; } - Vibration vib = new Vibration(token, milliseconds, streamHint, uid, packageName); + Vibration vib = new Vibration(token, milliseconds, streamHint, uid, opPkg); final long ident = Binder.clearCallingIdentity(); try { @@ -347,10 +347,10 @@ public class VibratorService extends IVibratorService.Stub private void startVibrationLocked(final Vibration vib) { try { int mode = mAppOpsService.checkAudioOperation(AppOpsManager.OP_VIBRATE, - vib.mStreamHint, vib.mUid, vib.mPackageName); + vib.mStreamHint, vib.mUid, vib.mOpPkg); if (mode == AppOpsManager.MODE_ALLOWED) { mode = mAppOpsService.startOperation(AppOpsManager.getToken(mAppOpsService), - AppOpsManager.OP_VIBRATE, vib.mUid, vib.mPackageName); + AppOpsManager.OP_VIBRATE, vib.mUid, vib.mOpPkg); } if (mode != AppOpsManager.MODE_ALLOWED) { if (mode == AppOpsManager.MODE_ERRORED) { @@ -377,7 +377,7 @@ public class VibratorService extends IVibratorService.Stub try { mAppOpsService.finishOperation(AppOpsManager.getToken(mAppOpsService), AppOpsManager.OP_VIBRATE, mCurrentVibration.mUid, - mCurrentVibration.mPackageName); + mCurrentVibration.mOpPkg); } catch (RemoteException e) { } mCurrentVibration = null; diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 5c14de1..5b597a3 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -1497,9 +1497,9 @@ public class NotificationManagerService extends SystemService { } @Override - public void enqueueNotificationWithTag(String pkg, String basePkg, String tag, int id, + public void enqueueNotificationWithTag(String pkg, String opPkg, String tag, int id, Notification notification, int[] idOut, int userId) throws RemoteException { - enqueueNotificationInternal(pkg, basePkg, Binder.getCallingUid(), + enqueueNotificationInternal(pkg, opPkg, Binder.getCallingUid(), Binder.getCallingPid(), tag, id, notification, idOut, userId); } @@ -1849,14 +1849,14 @@ public class NotificationManagerService extends SystemService { */ private final NotificationManagerInternal mInternalService = new NotificationManagerInternal() { @Override - public void enqueueNotification(String pkg, String basePkg, int callingUid, int callingPid, + public void enqueueNotification(String pkg, String opPkg, int callingUid, int callingPid, String tag, int id, Notification notification, int[] idReceived, int userId) { - enqueueNotificationInternal(pkg, basePkg, callingUid, callingPid, tag, id, notification, + enqueueNotificationInternal(pkg, opPkg, callingUid, callingPid, tag, id, notification, idReceived, userId); } }; - void enqueueNotificationInternal(final String pkg, String basePkg, final int callingUid, + void enqueueNotificationInternal(final String pkg, final String opPkg, final int callingUid, final int callingPid, final String tag, final int id, final Notification notification, int[] idOut, int incomingUserId) { if (DBG) { @@ -1981,7 +1981,8 @@ public class NotificationManagerService extends SystemService { if (DBG) Slog.v(TAG, "canInterrupt=" + canInterrupt + " intercept=" + intercept); synchronized (mNotificationList) { final StatusBarNotification n = new StatusBarNotification( - pkg, id, tag, callingUid, callingPid, score, notification, user); + pkg, opPkg, id, tag, callingUid, callingPid, score, notification, + user); NotificationRecord r = new NotificationRecord(n); NotificationRecord old = null; @@ -2157,7 +2158,7 @@ public class NotificationManagerService extends SystemService { // notifying app does not have the VIBRATE permission. long identity = Binder.clearCallingIdentity(); try { - mVibrator.vibrate(r.sbn.getUid(), r.sbn.getBasePkg(), + mVibrator.vibrate(r.sbn.getUid(), r.sbn.getOpPkg(), useDefaultVibrate ? mDefaultVibrationPattern : mFallbackVibrationPattern, ((notification.flags & Notification.FLAG_INSISTENT) != 0) @@ -2168,7 +2169,7 @@ public class NotificationManagerService extends SystemService { } else if (notification.vibrate.length > 1) { // If you want your own vibration pattern, you need the VIBRATE // permission - mVibrator.vibrate(r.sbn.getUid(), r.sbn.getBasePkg(), + mVibrator.vibrate(r.sbn.getUid(), r.sbn.getOpPkg(), notification.vibrate, ((notification.flags & Notification.FLAG_INSISTENT) != 0) ? 0: -1, notification.audioStreamType); |