Merge "No QS hotspot unless supported" into nyc-dev

am: 93e742b

* commit '93e742b58818b3c8130c6cf7ccaba2d0a77d3a72':
  No QS hotspot unless supported

Change-Id: I141c636c23907d19ee33444239afea3239d7e656
This commit is contained in:
Jason Monk
2016-04-19 15:26:09 +00:00
committed by android-build-merger
3 changed files with 12 additions and 0 deletions

View File

@@ -42,6 +42,11 @@ public class HotspotTile extends QSTile<QSTile.BooleanState> {
mController = host.getHotspotController();
}
@Override
public boolean isAvailable() {
return mController.isHotspotSupported();
}
@Override
protected void handleDestroy() {
super.handleDestroy();

View File

@@ -21,6 +21,7 @@ public interface HotspotController {
void removeCallback(Callback callback);
boolean isHotspotEnabled();
void setHotspotEnabled(boolean enabled);
boolean isHotspotSupported();
public interface Callback {
void onHotspotChanged(boolean enabled);

View File

@@ -46,6 +46,12 @@ public class HotspotControllerImpl implements HotspotController {
Context.CONNECTIVITY_SERVICE);
}
@Override
public boolean isHotspotSupported() {
return mConnectivityManager.isTetheringSupported()
&& mConnectivityManager.getTetherableWifiRegexs().length != 0;
}
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
pw.println("HotspotController state:");
pw.print(" mHotspotEnabled="); pw.println(stateToString(mHotspotState));