summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorJason Monk <jmonk@google.com>2014-10-07 14:22:59 -0400
committerJason Monk <jmonk@google.com>2014-10-07 14:43:11 -0400
commit20ef4024edb5c7ed08a660cea731d47bcf90add5 (patch)
treeb9855b996dc50ee9cf3d007104cdbc89c82c84ae /packages
parent53c84002911362c913bc72cd28d186718a33149d (diff)
downloadframeworks_base-20ef4024edb5c7ed08a660cea731d47bcf90add5.zip
frameworks_base-20ef4024edb5c7ed08a660cea731d47bcf90add5.tar.gz
frameworks_base-20ef4024edb5c7ed08a660cea731d47bcf90add5.tar.bz2
Hide hotspot tile if 'provisioning' is needed
If we need carrier entitlement checks don't show the hotspot tile which could bypass them, instead make the user go to settings. Bug: 17879554 Change-Id: I30a5b51b26a2d4e977579b71a16c3c7a8d004eea
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotController.java1
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java15
3 files changed, 18 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java
index 9984fca..ce99cc3 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java
@@ -66,7 +66,8 @@ public class HotspotTile extends QSTile<QSTile.BooleanState> {
@Override
protected void handleUpdateState(BooleanState state, Object arg) {
- state.visible = mController.isHotspotSupported() && mUsageTracker.isRecentlyUsed();
+ state.visible = mController.isHotspotSupported() && mUsageTracker.isRecentlyUsed()
+ && !mController.isProvisioningNeeded();
state.label = mContext.getString(R.string.quick_settings_hotspot_label);
state.value = mController.isHotspotEnabled();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotController.java
index 7ca91a5..0863c86 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotController.java
@@ -22,6 +22,7 @@ public interface HotspotController {
boolean isHotspotEnabled();
boolean isHotspotSupported();
void setHotspotEnabled(boolean enabled);
+ boolean isProvisioningNeeded();
public interface Callback {
void onHotspotChanged(boolean enabled);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java
index dd706bb9..63c1100 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java
@@ -24,6 +24,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.wifi.WifiManager;
+import android.os.SystemProperties;
import android.os.UserHandle;
import android.provider.Settings;
import android.util.Log;
@@ -74,6 +75,20 @@ public class HotspotControllerImpl implements HotspotController {
}
@Override
+ public boolean isProvisioningNeeded() {
+ // Keep in sync with other usage of config_mobile_hotspot_provision_app.
+ // TetherSettings#isProvisioningNeeded and
+ // ConnectivityManager#enforceTetherChangePermission
+ String[] provisionApp = mContext.getResources().getStringArray(
+ com.android.internal.R.array.config_mobile_hotspot_provision_app);
+ if (SystemProperties.getBoolean("net.tethering.noprovisioning", false)
+ || provisionApp == null) {
+ return false;
+ }
+ return (provisionApp.length == 2);
+ }
+
+ @Override
public void setHotspotEnabled(boolean enabled) {
final ContentResolver cr = mContext.getContentResolver();
// This needs to be kept up to date with Settings (WifiApEnabler.setSoftapEnabled)