Merge "Pass non-null message of window op to AppOps" into rvc-dev am: 202e38118a
Change-Id: I1dac45e67915a177ed78f994f4ecfe4c223dc308
This commit is contained in:
@@ -2139,8 +2139,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check if user has enabled this operation. SecurityException will be thrown if this app
|
// check if user has enabled this operation. SecurityException will be thrown if this app
|
||||||
// has not been allowed by the user
|
// has not been allowed by the user. The reason to use "noteOp" (instead of checkOp) is to
|
||||||
final int mode = mAppOpsManager.noteOpNoThrow(outAppOp[0], callingUid, packageName);
|
// make sure the usage is logged.
|
||||||
|
final int mode = mAppOpsManager.noteOpNoThrow(outAppOp[0], callingUid, packageName,
|
||||||
|
null /* featureId */, "check-add");
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case AppOpsManager.MODE_ALLOWED:
|
case AppOpsManager.MODE_ALLOWED:
|
||||||
case AppOpsManager.MODE_IGNORED:
|
case AppOpsManager.MODE_IGNORED:
|
||||||
|
|||||||
@@ -2938,8 +2938,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
// and add the window only if the permission was granted. Therefore, if
|
// 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
|
// the mode is MODE_DEFAULT we want the op to succeed as the window is
|
||||||
// shown.
|
// shown.
|
||||||
final int mode = mWmService.mAppOps.startOpNoThrow(mAppOp,
|
final int mode = mWmService.mAppOps.startOpNoThrow(mAppOp, getOwningUid(),
|
||||||
getOwningUid(), getOwningPackage(), true);
|
getOwningPackage(), true /* startIfModeDefault */, null /* featureId */,
|
||||||
|
"init-default-visibility");
|
||||||
if (mode != MODE_ALLOWED && mode != MODE_DEFAULT) {
|
if (mode != MODE_ALLOWED && mode != MODE_DEFAULT) {
|
||||||
setAppOpVisibilityLw(false);
|
setAppOpVisibilityLw(false);
|
||||||
}
|
}
|
||||||
@@ -2947,7 +2948,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
|
|
||||||
void resetAppOpsState() {
|
void resetAppOpsState() {
|
||||||
if (mAppOp != OP_NONE && mAppOpVisibility) {
|
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.
|
// as this would mean we will get another change callback and will reconcile.
|
||||||
int mode = mWmService.mAppOps.checkOpNoThrow(mAppOp, uid, packageName);
|
int mode = mWmService.mAppOps.checkOpNoThrow(mAppOp, uid, packageName);
|
||||||
if (mode != MODE_ALLOWED && mode != MODE_DEFAULT) {
|
if (mode != MODE_ALLOWED && mode != MODE_DEFAULT) {
|
||||||
mWmService.mAppOps.finishOp(mAppOp, uid, packageName);
|
mWmService.mAppOps.finishOp(mAppOp, uid, packageName, null /* featureId */);
|
||||||
setAppOpVisibilityLw(false);
|
setAppOpVisibilityLw(false);
|
||||||
}
|
}
|
||||||
} else {
|
} 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) {
|
if (mode == MODE_ALLOWED || mode == MODE_DEFAULT) {
|
||||||
setAppOpVisibilityLw(true);
|
setAppOpVisibilityLw(true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user