Add WiFi toggle prompts - framework
am: 6c3032f16b
Change-Id: Ie89a9b91b8b1cd7158a743d8b5870d8f9d6f8adc
This commit is contained in:
@@ -52,7 +52,7 @@ public class WifiCommand extends Svc.Command {
|
|||||||
IWifiManager wifiMgr
|
IWifiManager wifiMgr
|
||||||
= IWifiManager.Stub.asInterface(ServiceManager.getService(Context.WIFI_SERVICE));
|
= IWifiManager.Stub.asInterface(ServiceManager.getService(Context.WIFI_SERVICE));
|
||||||
try {
|
try {
|
||||||
wifiMgr.setWifiEnabled(flag);
|
wifiMgr.setWifiEnabled("com.android.shell", flag);
|
||||||
}
|
}
|
||||||
catch (RemoteException e) {
|
catch (RemoteException e) {
|
||||||
System.err.println("Wi-Fi operation failed: " + e);
|
System.err.println("Wi-Fi operation failed: " + e);
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ interface IWifiManager
|
|||||||
|
|
||||||
WifiInfo getConnectionInfo();
|
WifiInfo getConnectionInfo();
|
||||||
|
|
||||||
boolean setWifiEnabled(boolean enable);
|
boolean setWifiEnabled(String packageName, boolean enable);
|
||||||
|
|
||||||
int getWifiEnabledState();
|
int getWifiEnabledState();
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package android.net.wifi;
|
|||||||
import android.annotation.SdkConstant;
|
import android.annotation.SdkConstant;
|
||||||
import android.annotation.SdkConstant.SdkConstantType;
|
import android.annotation.SdkConstant.SdkConstantType;
|
||||||
import android.annotation.SystemApi;
|
import android.annotation.SystemApi;
|
||||||
|
import android.bluetooth.BluetoothAdapter;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.DhcpInfo;
|
import android.net.DhcpInfo;
|
||||||
@@ -563,6 +564,28 @@ public class WifiManager {
|
|||||||
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
|
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
|
||||||
public static final String ACTION_PICK_WIFI_NETWORK = "android.net.wifi.PICK_WIFI_NETWORK";
|
public static final String ACTION_PICK_WIFI_NETWORK = "android.net.wifi.PICK_WIFI_NETWORK";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Activity Action: Show UI to get user approval to enable WiFi.
|
||||||
|
* <p>Input: {@link android.content.Intent#EXTRA_PACKAGE_NAME} string extra with
|
||||||
|
* the name of the app requesting the action.
|
||||||
|
* <p>Output: Nothing.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
|
||||||
|
public static final String ACTION_REQUEST_ENABLE = "android.net.wifi.action.REQUEST_ENABLE";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Activity Action: Show UI to get user approval to disable WiFi.
|
||||||
|
* <p>Input: {@link android.content.Intent#EXTRA_PACKAGE_NAME} string extra with
|
||||||
|
* the name of the app requesting the action.
|
||||||
|
* <p>Output: Nothing.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
|
||||||
|
public static final String ACTION_REQUEST_DISABLE = "android.net.wifi.action.REQUEST_DISABLE";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internally used Wi-Fi lock mode representing the case were no locks are held.
|
* Internally used Wi-Fi lock mode representing the case were no locks are held.
|
||||||
* @hide
|
* @hide
|
||||||
@@ -1462,7 +1485,7 @@ public class WifiManager {
|
|||||||
*/
|
*/
|
||||||
public boolean setWifiEnabled(boolean enabled) {
|
public boolean setWifiEnabled(boolean enabled) {
|
||||||
try {
|
try {
|
||||||
return mService.setWifiEnabled(enabled);
|
return mService.setWifiEnabled(mContext.getOpPackageName(), enabled);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user