* commit '000b85fa8ca68b530b18a7318f8ac49b76b1114f': Hide hotspot tile if 'provisioning' is needed
This commit is contained in:
@@ -66,7 +66,8 @@ public class HotspotTile extends QSTile<QSTile.BooleanState> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handleUpdateState(BooleanState state, Object arg) {
|
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.label = mContext.getString(R.string.quick_settings_hotspot_label);
|
||||||
|
|
||||||
state.value = mController.isHotspotEnabled();
|
state.value = mController.isHotspotEnabled();
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ public interface HotspotController {
|
|||||||
boolean isHotspotEnabled();
|
boolean isHotspotEnabled();
|
||||||
boolean isHotspotSupported();
|
boolean isHotspotSupported();
|
||||||
void setHotspotEnabled(boolean enabled);
|
void setHotspotEnabled(boolean enabled);
|
||||||
|
boolean isProvisioningNeeded();
|
||||||
|
|
||||||
public interface Callback {
|
public interface Callback {
|
||||||
void onHotspotChanged(boolean enabled);
|
void onHotspotChanged(boolean enabled);
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import android.content.Intent;
|
|||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.wifi.WifiManager;
|
import android.net.wifi.WifiManager;
|
||||||
|
import android.os.SystemProperties;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -73,6 +74,20 @@ public class HotspotControllerImpl implements HotspotController {
|
|||||||
return !isSecondaryUser && mConnectivityManager.isTetheringSupported();
|
return !isSecondaryUser && mConnectivityManager.isTetheringSupported();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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
|
@Override
|
||||||
public void setHotspotEnabled(boolean enabled) {
|
public void setHotspotEnabled(boolean enabled) {
|
||||||
final ContentResolver cr = mContext.getContentResolver();
|
final ContentResolver cr = mContext.getContentResolver();
|
||||||
|
|||||||
Reference in New Issue
Block a user