Add shell command to query Restricted Mode state am: ce9f94d956
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1545867 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: If8f0ebad3b3aa8d0552f75b2927607e616970a0d
This commit is contained in:
@@ -3864,6 +3864,13 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
boolean isRestrictedModeEnabled() {
|
||||||
|
synchronized (mUidRulesFirstLock) {
|
||||||
|
return mRestrictedNetworkingMode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* updates restricted mode state / access for all apps
|
* updates restricted mode state / access for all apps
|
||||||
* Called on initialization and when restricted mode is enabled / disabled.
|
* Called on initialization and when restricted mode is enabled / disabled.
|
||||||
|
|||||||
@@ -119,6 +119,8 @@ class NetworkPolicyManagerShellCommand extends ShellCommand {
|
|||||||
switch(type) {
|
switch(type) {
|
||||||
case "restrict-background":
|
case "restrict-background":
|
||||||
return getRestrictBackground();
|
return getRestrictBackground();
|
||||||
|
case "restricted-mode":
|
||||||
|
return getRestrictedModeState();
|
||||||
}
|
}
|
||||||
pw.println("Error: unknown get type '" + type + "'");
|
pw.println("Error: unknown get type '" + type + "'");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -255,6 +257,13 @@ class NetworkPolicyManagerShellCommand extends ShellCommand {
|
|||||||
return listUidList("App Idle whitelisted UIDs", uids);
|
return listUidList("App Idle whitelisted UIDs", uids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getRestrictedModeState() {
|
||||||
|
final PrintWriter pw = getOutPrintWriter();
|
||||||
|
pw.print("Restricted mode status: ");
|
||||||
|
pw.println(mInterface.isRestrictedModeEnabled() ? "enabled" : "disabled");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
private int getRestrictBackground() throws RemoteException {
|
private int getRestrictBackground() throws RemoteException {
|
||||||
final PrintWriter pw = getOutPrintWriter();
|
final PrintWriter pw = getOutPrintWriter();
|
||||||
pw.print("Restrict background status: ");
|
pw.print("Restrict background status: ");
|
||||||
|
|||||||
Reference in New Issue
Block a user