summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2011-08-16 14:37:57 -0700
committerJeff Sharkey <jsharkey@android.com>2011-08-17 14:12:42 -0700
commit3a844fcf5a0e70a19c38dc500306b9ebe4e1413b (patch)
treec835cc97cc3051ee80f29b693d26edd5986b5aa2 /core/java
parentb51645ee2c7608f0b1a50d09f203cf5323b0b02d (diff)
Background data notification, API clean up.
When restricting background data, show ongoing notification to give easy access to re-enable. Deprecate getBackgroundDataSetting() API to always return true, since NetworkInfo.isConnected() is new source of truth. Handle upgrade path by reading from existing secure value, and kick one last broadcast when changing value. Remove background data code from ConnectivityService. Remove warning alerts, since they push ifaces into restricted list; should only happen when iface has limit. Bug: 5163559, 5129421 Change-Id: I0064d9d643656a4d32aaae51d4a58bce49fe295f
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/net/ConnectivityManager.java22
-rw-r--r--core/java/android/net/IConnectivityManager.aidl4
-rw-r--r--core/java/android/provider/Settings.java1
3 files changed, 13 insertions, 14 deletions
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java
index eb9cd213dd8e..68e80ff7d262 100644
--- a/core/java/android/net/ConnectivityManager.java
+++ b/core/java/android/net/ConnectivityManager.java
@@ -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;
@@ -494,16 +495,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;
}
/**
@@ -516,11 +520,9 @@ public class ConnectivityManager {
* @see #getBackgroundDataSetting()
* @hide
*/
+ @Deprecated
public void setBackgroundDataSetting(boolean allowBackgroundData) {
- try {
- mService.setBackgroundDataSetting(allowBackgroundData);
- } catch (RemoteException e) {
- }
+ // ignored
}
/**
diff --git a/core/java/android/net/IConnectivityManager.aidl b/core/java/android/net/IConnectivityManager.aidl
index f3912005a667..1b95b60a536d 100644
--- a/core/java/android/net/IConnectivityManager.aidl
+++ b/core/java/android/net/IConnectivityManager.aidl
@@ -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);
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index f8702b9d9117..a380efcc7338 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -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";
/**