summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorJason Monk <jmonk@google.com>2014-10-07 18:53:20 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-10-07 18:53:20 +0000
commit733bcc7fbe8f03c92f20c57dd25cbc3b011cef9e (patch)
tree7fd0d9ca2aaddfa391bc16ecd6ef23dc7dd7520c /packages
parent258d222152a410341ddad045ce92e57dd7ab454e (diff)
parent20ef4024edb5c7ed08a660cea731d47bcf90add5 (diff)
downloadframeworks_base-733bcc7fbe8f03c92f20c57dd25cbc3b011cef9e.zip
frameworks_base-733bcc7fbe8f03c92f20c57dd25cbc3b011cef9e.tar.gz
frameworks_base-733bcc7fbe8f03c92f20c57dd25cbc3b011cef9e.tar.bz2
Merge "Hide hotspot tile if 'provisioning' is needed" into lmp-dev
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)