Merge "No QS hotspot unless supported" into nyc-dev
This commit is contained in:
@@ -42,6 +42,11 @@ public class HotspotTile extends QSTile<QSTile.BooleanState> {
|
|||||||
mController = host.getHotspotController();
|
mController = host.getHotspotController();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAvailable() {
|
||||||
|
return mController.isHotspotSupported();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handleDestroy() {
|
protected void handleDestroy() {
|
||||||
super.handleDestroy();
|
super.handleDestroy();
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ public interface HotspotController {
|
|||||||
void removeCallback(Callback callback);
|
void removeCallback(Callback callback);
|
||||||
boolean isHotspotEnabled();
|
boolean isHotspotEnabled();
|
||||||
void setHotspotEnabled(boolean enabled);
|
void setHotspotEnabled(boolean enabled);
|
||||||
|
boolean isHotspotSupported();
|
||||||
|
|
||||||
public interface Callback {
|
public interface Callback {
|
||||||
void onHotspotChanged(boolean enabled);
|
void onHotspotChanged(boolean enabled);
|
||||||
|
|||||||
@@ -46,6 +46,12 @@ public class HotspotControllerImpl implements HotspotController {
|
|||||||
Context.CONNECTIVITY_SERVICE);
|
Context.CONNECTIVITY_SERVICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isHotspotSupported() {
|
||||||
|
return mConnectivityManager.isTetheringSupported()
|
||||||
|
&& mConnectivityManager.getTetherableWifiRegexs().length != 0;
|
||||||
|
}
|
||||||
|
|
||||||
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||||
pw.println("HotspotController state:");
|
pw.println("HotspotController state:");
|
||||||
pw.print(" mHotspotEnabled="); pw.println(stateToString(mHotspotState));
|
pw.print(" mHotspotEnabled="); pw.println(stateToString(mHotspotState));
|
||||||
|
|||||||
Reference in New Issue
Block a user