Merge "Rename basePkg to opPkg"
This commit is contained in:
committed by
Android (Google) Code Review
commit
d67d073b9f
@@ -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);
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user