am 9a20fa54: Merge "Background data notification, API clean up."
* commit '9a20fa54c9ba4bd19f2afd6e8cc6e9954e7cb739': Background data notification, API clean up.
This commit is contained in:
@@ -21,6 +21,7 @@ import static com.android.internal.util.Preconditions.checkNotNull;
|
||||
import android.annotation.SdkConstant;
|
||||
import android.annotation.SdkConstant.SdkConstantType;
|
||||
import android.os.Binder;
|
||||
import android.os.Build.VERSION_CODES;
|
||||
import android.os.RemoteException;
|
||||
|
||||
import java.net.InetAddress;
|
||||
@@ -503,16 +504,19 @@ public class ConnectivityManager {
|
||||
* <p>
|
||||
* All applications that have background services that use the network
|
||||
* should listen to {@link #ACTION_BACKGROUND_DATA_SETTING_CHANGED}.
|
||||
* <p>
|
||||
* As of {@link VERSION_CODES#ICE_CREAM_SANDWICH}, availability of
|
||||
* background data depends on several combined factors, and this method will
|
||||
* always return {@code true}. Instead, when background data is unavailable,
|
||||
* {@link #getActiveNetworkInfo()} will now appear disconnected.
|
||||
*
|
||||
* @return Whether background data usage is allowed.
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean getBackgroundDataSetting() {
|
||||
try {
|
||||
return mService.getBackgroundDataSetting();
|
||||
} catch (RemoteException e) {
|
||||
// Err on the side of safety
|
||||
return false;
|
||||
}
|
||||
// assume that background data is allowed; final authority is
|
||||
// NetworkInfo which may be blocked.
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -525,11 +529,9 @@ public class ConnectivityManager {
|
||||
* @see #getBackgroundDataSetting()
|
||||
* @hide
|
||||
*/
|
||||
@Deprecated
|
||||
public void setBackgroundDataSetting(boolean allowBackgroundData) {
|
||||
try {
|
||||
mService.setBackgroundDataSetting(allowBackgroundData);
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
// ignored
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -63,10 +63,6 @@ interface IConnectivityManager
|
||||
|
||||
boolean requestRouteToHostAddress(int networkType, in byte[] hostAddress);
|
||||
|
||||
boolean getBackgroundDataSetting();
|
||||
|
||||
void setBackgroundDataSetting(boolean allowBackgroundData);
|
||||
|
||||
boolean getMobileDataEnabled();
|
||||
|
||||
void setMobileDataEnabled(boolean enabled);
|
||||
|
||||
@@ -3081,6 +3081,7 @@ public final class Settings {
|
||||
* Whether background data usage is allowed by the user. See
|
||||
* ConnectivityManager for more info.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String BACKGROUND_DATA = "background_data";
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user