summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Podogov <ginkage@google.com>2016-12-05 16:47:34 +0000
committerIvan Podogov <ginkage@google.com>2016-12-28 11:18:07 +0000
commit02938a0a735da7fafaaed84e31e1aa93cdf80a56 (patch)
tree4b67ee34b83fa16839f7ac9168765f9881cbde91
parent64acb4210ced1920fc29caa98a353b2968fd33b5 (diff)
In permission review mode, always request user's consent to toggle WiFi.
Bug: 33155556 Test: Manual: flash the watch, check that the consent UI was displayed in both apps (the one with CompileSDK=21 and TargetSDK=21, and the one with CompileSDK=25 and TargetSDK=25). Change-Id: I41d9adb916c12327643d59fd05a50d097800e2ac
-rw-r--r--service/java/com/android/server/wifi/WifiServiceImpl.java23
1 files changed, 10 insertions, 13 deletions
diff --git a/service/java/com/android/server/wifi/WifiServiceImpl.java b/service/java/com/android/server/wifi/WifiServiceImpl.java
index 18681484b..cecb3e2bc 100644
--- a/service/java/com/android/server/wifi/WifiServiceImpl.java
+++ b/service/java/com/android/server/wifi/WifiServiceImpl.java
@@ -600,14 +600,14 @@ public class WifiServiceImpl extends IWifiManager.Stub {
if (enable) {
if (wiFiEnabledState == WifiManager.WIFI_STATE_DISABLING
|| wiFiEnabledState == WifiManager.WIFI_STATE_DISABLED) {
- if (startConsentUiIfNeeded(packageName, Binder.getCallingUid(),
+ if (startConsentUi(packageName, Binder.getCallingUid(),
WifiManager.ACTION_REQUEST_ENABLE)) {
return true;
}
}
} else if (wiFiEnabledState == WifiManager.WIFI_STATE_ENABLING
|| wiFiEnabledState == WifiManager.WIFI_STATE_ENABLED) {
- if (startConsentUiIfNeeded(packageName, Binder.getCallingUid(),
+ if (startConsentUi(packageName, Binder.getCallingUid(),
WifiManager.ACTION_REQUEST_DISABLE)) {
return true;
}
@@ -1344,7 +1344,7 @@ public class WifiServiceImpl extends IWifiManager.Stub {
}
};
- private boolean startConsentUiIfNeeded(String packageName,
+ private boolean startConsentUi(String packageName,
int callingUid, String intentAction) throws RemoteException {
if (UserHandle.getAppId(callingUid) == Process.SYSTEM_UID) {
return false;
@@ -1360,19 +1360,16 @@ public class WifiServiceImpl extends IWifiManager.Stub {
+ " not in uid " + callingUid);
}
- // Legacy apps in permission review mode trigger a user prompt
- if (applicationInfo.targetSdkVersion < Build.VERSION_CODES.M) {
- Intent intent = new Intent(intentAction);
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
- | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
- intent.putExtra(Intent.EXTRA_PACKAGE_NAME, packageName);
- mContext.startActivity(intent);
- return true;
- }
+ // Permission review mode, trigger a user prompt
+ Intent intent = new Intent(intentAction);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
+ | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
+ intent.putExtra(Intent.EXTRA_PACKAGE_NAME, packageName);
+ mContext.startActivity(intent);
+ return true;
} catch (PackageManager.NameNotFoundException e) {
throw new RemoteException(e.getMessage());
}
- return false;
}
/**