Merge "Pass non-null message of window op to AppOps" into rvc-dev am: 202e38118a am: 3204aed3eb

Change-Id: I0d96c005559c0991baf4f1fa4928117124ca9801
This commit is contained in:
Automerger Merge Worker
2020-03-16 04:20:50 +00:00
2 changed files with 12 additions and 7 deletions

View File

@@ -2139,8 +2139,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
// check if user has enabled this operation. SecurityException will be thrown if this app
// has not been allowed by the user
final int mode = mAppOpsManager.noteOpNoThrow(outAppOp[0], callingUid, packageName);
// has not been allowed by the user. The reason to use "noteOp" (instead of checkOp) is to
// make sure the usage is logged.
final int mode = mAppOpsManager.noteOpNoThrow(outAppOp[0], callingUid, packageName,
null /* featureId */, "check-add");
switch (mode) {
case AppOpsManager.MODE_ALLOWED:
case AppOpsManager.MODE_IGNORED:

View File

@@ -2938,8 +2938,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
// and add the window only if the permission was granted. Therefore, if
// the mode is MODE_DEFAULT we want the op to succeed as the window is
// shown.
final int mode = mWmService.mAppOps.startOpNoThrow(mAppOp,
getOwningUid(), getOwningPackage(), true);
final int mode = mWmService.mAppOps.startOpNoThrow(mAppOp, getOwningUid(),
getOwningPackage(), true /* startIfModeDefault */, null /* featureId */,
"init-default-visibility");
if (mode != MODE_ALLOWED && mode != MODE_DEFAULT) {
setAppOpVisibilityLw(false);
}
@@ -2947,7 +2948,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
void resetAppOpsState() {
if (mAppOp != OP_NONE && mAppOpVisibility) {
mWmService.mAppOps.finishOp(mAppOp, getOwningUid(), getOwningPackage());
mWmService.mAppOps.finishOp(mAppOp, getOwningUid(), getOwningPackage(),
null /* featureId */);
}
}
@@ -2962,11 +2964,12 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
// as this would mean we will get another change callback and will reconcile.
int mode = mWmService.mAppOps.checkOpNoThrow(mAppOp, uid, packageName);
if (mode != MODE_ALLOWED && mode != MODE_DEFAULT) {
mWmService.mAppOps.finishOp(mAppOp, uid, packageName);
mWmService.mAppOps.finishOp(mAppOp, uid, packageName, null /* featureId */);
setAppOpVisibilityLw(false);
}
} else {
final int mode = mWmService.mAppOps.startOpNoThrow(mAppOp, uid, packageName, true);
final int mode = mWmService.mAppOps.startOpNoThrow(mAppOp, uid, packageName,
true /* startIfModeDefault */, null /* featureId */, "attempt-to-be-visible");
if (mode == MODE_ALLOWED || mode == MODE_DEFAULT) {
setAppOpVisibilityLw(true);
}