diff options
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/app/ContextImpl.java | 4 | ||||
| -rw-r--r-- | core/java/android/content/Context.java | 4 | ||||
| -rw-r--r-- | core/java/android/net/ConnectivityManager.java | 257 | ||||
| -rw-r--r-- | core/java/android/net/Network.java | 3 | ||||
| -rw-r--r-- | core/java/android/net/NetworkRequest.java | 8 | ||||
| -rw-r--r-- | core/java/android/provider/Settings.java | 45 | ||||
| -rw-r--r-- | core/java/android/view/InputDevice.java | 8 | ||||
| -rw-r--r-- | core/java/android/view/KeyEvent.java | 20 | ||||
| -rw-r--r-- | core/java/android/view/ThreadedRenderer.java | 2 | ||||
| -rw-r--r-- | core/java/android/view/View.java | 61 | ||||
| -rw-r--r-- | core/java/android/widget/AbsListView.java | 21 | ||||
| -rw-r--r-- | core/java/android/widget/AbsSeekBar.java | 20 | ||||
| -rw-r--r-- | core/java/android/widget/CompoundButton.java | 2 | ||||
| -rw-r--r-- | core/java/android/widget/Switch.java | 2 | ||||
| -rw-r--r-- | core/java/android/widget/TextView.java | 2 | ||||
| -rw-r--r-- | core/java/com/android/internal/statusbar/IStatusBar.aidl | 2 | ||||
| -rw-r--r-- | core/java/com/android/internal/statusbar/IStatusBarService.aidl | 2 |
17 files changed, 261 insertions, 202 deletions
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java index ca6b008..6324d4c 100644 --- a/core/java/android/app/ContextImpl.java +++ b/core/java/android/app/ContextImpl.java @@ -70,7 +70,7 @@ import android.location.ILocationManager; import android.location.LocationManager; import android.media.AudioManager; import android.media.MediaRouter; -import android.media.session.SessionManager; +import android.media.session.MediaSessionManager; import android.net.ConnectivityManager; import android.net.IConnectivityManager; import android.net.INetworkPolicyManager; @@ -657,7 +657,7 @@ class ContextImpl extends Context { registerService(MEDIA_SESSION_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { - return new SessionManager(ctx); + return new MediaSessionManager(ctx); } }); registerService(TRUST_SERVICE, new ServiceFetcher() { diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index f7f51fe..c11b04c 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -2422,10 +2422,10 @@ public abstract class Context { /** * Use with {@link #getSystemService} to retrieve a - * {@link android.media.session.SessionManager} for managing media Sessions. + * {@link android.media.session.MediaSessionManager} for managing media Sessions. * * @see #getSystemService - * @see android.media.session.SessionManager + * @see android.media.session.MediaSessionManager */ public static final String MEDIA_SESSION_SERVICE = "media_session"; diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java index a414421..1837335 100644 --- a/core/java/android/net/ConnectivityManager.java +++ b/core/java/android/net/ConnectivityManager.java @@ -21,6 +21,7 @@ import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.app.PendingIntent; import android.content.Context; +import android.content.Intent; import android.os.Binder; import android.os.Build.VERSION_CODES; import android.os.Handler; @@ -57,13 +58,15 @@ import com.android.internal.util.Protocol; * is lost</li> * <li>Provide an API that allows applications to query the coarse-grained or fine-grained * state of the available networks</li> + * <li>Provide an API that allows applications to request and select networks for their data + * traffic</li> * </ol> */ public class ConnectivityManager { private static final String TAG = "ConnectivityManager"; /** - * A change in network connectivity has occurred. A connection has either + * A change in network connectivity has occurred. A default connection has either * been established or lost. The NetworkInfo for the affected network is * sent as an extra; it should be consulted to see what kind of * connectivity event occurred. @@ -547,13 +550,12 @@ public class ConnectivityManager { * @param preference the network type to prefer over all others. It is * unspecified what happens to the old preferred network in the * overall ordering. + * @deprecated Functionality has been removed as it no longer makes sense, + * with many more than two networks - we'd need an array to express + * preference. Instead we use dynamic network properties of + * the networks to describe their precedence. */ public void setNetworkPreference(int preference) { - // TODO - deprecate with: - // @deprecated Functionality has been removed as it no longer makes sense, - // with many more than two networks - we'd need an array to express - // preference. Instead we use dynamic network properties of - // the networks to describe their precedence. } /** @@ -563,14 +565,13 @@ public class ConnectivityManager { * * <p>This method requires the caller to hold the permission * {@link android.Manifest.permission#ACCESS_NETWORK_STATE}. + * @deprecated Functionality has been removed as it no longer makes sense, + * with many more than two networks - we'd need an array to express + * preference. Instead we use dynamic network properties of + * the networks to describe their precedence. */ public int getNetworkPreference() { - // TODO - deprecate with: - // @deprecated Functionality has been removed as it no longer makes sense, - // with many more than two networks - we'd need an array to express - // preference. Instead we use dynamic network properties of - // the networks to describe their precedence. - return -1; + return TYPE_NONE; } /** @@ -716,7 +717,13 @@ public class ConnectivityManager { } } - /** {@hide} */ + /** + * Get the {@link LinkProperties} for the given {@link Network}. This + * will return {@code null} if the network is unknown. + * + * @param network The {@link Network} object identifying the network in question. + * @return The {@link LinkProperties} for the network, or {@code null}. + **/ public LinkProperties getLinkProperties(Network network) { try { return mService.getLinkProperties(network); @@ -725,7 +732,13 @@ public class ConnectivityManager { } } - /** {@hide} */ + /** + * Get the {@link NetworkCapabilities} for the given {@link Network}. This + * will return {@code null} if the network is unknown. + * + * @param network The {@link Network} object identifying the network in question. + * @return The {@link NetworkCapabilities} for the network, or {@code null}. + */ public NetworkCapabilities getNetworkCapabilities(Network network) { try { return mService.getNetworkCapabilities(network); @@ -788,6 +801,8 @@ public class ConnectivityManager { * The interpretation of this value is specific to each networking * implementation+feature combination, except that the value {@code -1} * always indicates failure. + * + * @deprecated Deprecated in favor of the cleaner {@link #requestNetwork} api. */ public int startUsingNetworkFeature(int networkType, String feature) { try { @@ -810,6 +825,8 @@ public class ConnectivityManager { * The interpretation of this value is specific to each networking * implementation+feature combination, except that the value {@code -1} * always indicates failure. + * + * @deprecated Deprecated in favor of the cleaner {@link #requestNetwork} api. */ public int stopUsingNetworkFeature(int networkType, String feature) { try { @@ -829,6 +846,9 @@ public class ConnectivityManager { * host is to be routed * @param hostAddress the IP address of the host to which the route is desired * @return {@code true} on success, {@code false} on failure + * + * @deprecated Deprecated in favor of the {@link #requestNetwork}, + * {@link Network#bindProcess} and {@link Network#socketFactory} api. */ public boolean requestRouteToHost(int networkType, int hostAddress) { InetAddress inetAddress = NetworkUtils.intToInetAddress(hostAddress); @@ -851,6 +871,8 @@ public class ConnectivityManager { * @param hostAddress the IP address of the host to which the route is desired * @return {@code true} on success, {@code false} on failure * @hide + * @deprecated Deprecated in favor of the {@link #requestNetwork} and + * {@link Network#bindProcess} api. */ public boolean requestRouteToHostAddress(int networkType, InetAddress hostAddress) { byte[] address = hostAddress.getAddress(); @@ -1332,13 +1354,13 @@ public class ConnectivityManager { } /** - * Report a problem network to the framework. This will cause the framework - * to evaluate the situation and try to fix any problems. Note that false - * may be subsequently ignored. + * Report a problem network to the framework. This provides a hint to the system + * that there might be connectivity problems on this network and may cause + * the framework to re-evaluate network connectivity and/or switch to another + * network. * - * @param network The Network the application was attempting to use or null - * to indicate the current default network. - * {@hide} + * @param network The {@link Network} the application was attempting to use + * or {@code null} to indicate the current default network. */ public void reportBadNetwork(Network network) { try { @@ -1358,6 +1380,7 @@ public class ConnectivityManager { * * <p>This method requires the call to hold the permission * android.Manifest.permission#CONNECTIVITY_INTERNAL. + * @hide */ public void setGlobalProxy(ProxyInfo p) { try { @@ -1374,6 +1397,7 @@ public class ConnectivityManager { * * <p>This method requires the call to hold the permission * {@link android.Manifest.permission#ACCESS_NETWORK_STATE}. + * @hide */ public ProxyInfo getGlobalProxy() { try { @@ -1393,6 +1417,7 @@ public class ConnectivityManager { * <p>This method requires the call to hold the permission * {@link android.Manifest.permission#ACCESS_NETWORK_STATE}. * {@hide} + * @deprecated Deprecated in favor of {@link #getLinkProperties} */ public ProxyInfo getProxy() { try { @@ -1645,11 +1670,10 @@ public class ConnectivityManager { } /** - * Interface for NetworkRequest callbacks. Used for notifications about network - * changes. - * @hide + * Base class for NetworkRequest callbacks. Used for notifications about network + * changes. Should be extended by applications wanting notifications. */ - public static class NetworkCallbacks { + public static class NetworkCallbackListener { /** @hide */ public static final int PRECHECK = 1; /** @hide */ @@ -1675,51 +1699,73 @@ public class ConnectivityManager { public void onPreCheck(NetworkRequest networkRequest, Network network) {} /** - * Called when the framework connects and has validated the new network. + * Called when the framework connects and has declared new network ready for use. + * + * @param networkRequest The {@link NetworkRequest} used to initiate the request. + * @param network The {@link Network} of the satisfying network. */ public void onAvailable(NetworkRequest networkRequest, Network network) {} /** - * Called when the framework is losing the network. Often paired with an - * onAvailable call with the new replacement network for graceful handover. - * This may not be called if we have a hard loss (loss without warning). - * This may be followed by either an onLost call or an onAvailable call for this - * network depending on if we lose or regain it. + * Called when the network is about to be disconnected. Often paired with an + * {@link NetworkCallbackListener#onAvailable} call with the new replacement network + * for graceful handover. This may not be called if we have a hard loss + * (loss without warning). This may be followed by either a + * {@link NetworkCallbackListener#onLost} call or a + * {@link NetworkCallbackListener#onAvailable} call for this network depending + * on whether we lose or regain it. + * + * @param networkRequest The {@link NetworkRequest} used to initiate the request. + * @param network The {@link Network} of the failing network. + * @param maxSecToLive The time in seconds the framework will attempt to keep the + * network connected. Note that the network may suffers a + * hard loss at any time. */ public void onLosing(NetworkRequest networkRequest, Network network, int maxSecToLive) {} /** * Called when the framework has a hard loss of the network or when the - * graceful failure ends. Note applications should only request this callback - * if the application is willing to track the Available and Lost callbacks - * together, else the application may think it has no network when it - * really does (A Avail, B Avail, A Lost.. still have B). + * graceful failure ends. + * + * @param networkRequest The {@link NetworkRequest} used to initiate the request. + * @param network The {@link Network} lost. */ public void onLost(NetworkRequest networkRequest, Network network) {} /** * Called if no network is found in the given timeout time. If no timeout is given, * this will not be called. + * @hide */ public void onUnavailable(NetworkRequest networkRequest) {} /** * Called when the network the framework connected to for this request * changes capabilities but still satisfies the stated need. + * + * @param networkRequest The {@link NetworkRequest} used to initiate the request. + * @param network The {@link Network} whose capabilities have changed. + * @param networkCapabilities The new {@link NetworkCapabilities} for this network. */ public void onNetworkCapabilitiesChanged(NetworkRequest networkRequest, Network network, NetworkCapabilities networkCapabilities) {} /** * Called when the network the framework connected to for this request - * changes LinkProperties. + * changes {@link LinkProperties}. + * + * @param networkRequest The {@link NetworkRequest} used to initiate the request. + * @param network The {@link Network} whose link properties have changed. + * @param linkProperties The new {@link LinkProperties} for this network. */ public void onLinkPropertiesChanged(NetworkRequest networkRequest, Network network, LinkProperties linkProperties) {} /** - * Called when a releaseNetworkRequest call concludes and the registered callbacks will - * no longer be used. + * Called when a {@link #releaseNetworkRequest} call concludes and the registered + * callbacks will no longer be used. + * + * @param networkRequest The {@link NetworkRequest} used to initiate the request. */ public void onReleased(NetworkRequest networkRequest) {} } @@ -1745,12 +1791,12 @@ public class ConnectivityManager { public static final int CALLBACK_EXIT = BASE + 9; private static class CallbackHandler extends Handler { - private final HashMap<NetworkRequest, NetworkCallbacks>mCallbackMap; + private final HashMap<NetworkRequest, NetworkCallbackListener>mCallbackMap; private final AtomicInteger mRefCount; private static final String TAG = "ConnectivityManager.CallbackHandler"; private final ConnectivityManager mCm; - CallbackHandler(Looper looper, HashMap<NetworkRequest, NetworkCallbacks>callbackMap, + CallbackHandler(Looper looper, HashMap<NetworkRequest, NetworkCallbackListener>callbackMap, AtomicInteger refCount, ConnectivityManager cm) { super(looper); mCallbackMap = callbackMap; @@ -1764,7 +1810,7 @@ public class ConnectivityManager { switch (message.what) { case CALLBACK_PRECHECK: { NetworkRequest request = getNetworkRequest(message); - NetworkCallbacks callbacks = getCallbacks(request); + NetworkCallbackListener callbacks = getCallbacks(request); if (callbacks != null) { callbacks.onPreCheck(request, getNetwork(message)); } else { @@ -1774,7 +1820,7 @@ public class ConnectivityManager { } case CALLBACK_AVAILABLE: { NetworkRequest request = getNetworkRequest(message); - NetworkCallbacks callbacks = getCallbacks(request); + NetworkCallbackListener callbacks = getCallbacks(request); if (callbacks != null) { callbacks.onAvailable(request, getNetwork(message)); } else { @@ -1784,7 +1830,7 @@ public class ConnectivityManager { } case CALLBACK_LOSING: { NetworkRequest request = getNetworkRequest(message); - NetworkCallbacks callbacks = getCallbacks(request); + NetworkCallbackListener callbacks = getCallbacks(request); if (callbacks != null) { callbacks.onLosing(request, getNetwork(message), message.arg1); } else { @@ -1794,7 +1840,7 @@ public class ConnectivityManager { } case CALLBACK_LOST: { NetworkRequest request = getNetworkRequest(message); - NetworkCallbacks callbacks = getCallbacks(request); + NetworkCallbackListener callbacks = getCallbacks(request); if (callbacks != null) { callbacks.onLost(request, getNetwork(message)); } else { @@ -1804,7 +1850,7 @@ public class ConnectivityManager { } case CALLBACK_UNAVAIL: { NetworkRequest req = (NetworkRequest)message.obj; - NetworkCallbacks callbacks = null; + NetworkCallbackListener callbacks = null; synchronized(mCallbackMap) { callbacks = mCallbackMap.get(req); } @@ -1817,7 +1863,7 @@ public class ConnectivityManager { } case CALLBACK_CAP_CHANGED: { NetworkRequest request = getNetworkRequest(message); - NetworkCallbacks callbacks = getCallbacks(request); + NetworkCallbackListener callbacks = getCallbacks(request); if (callbacks != null) { Network network = getNetwork(message); NetworkCapabilities cap = mCm.getNetworkCapabilities(network); @@ -1830,7 +1876,7 @@ public class ConnectivityManager { } case CALLBACK_IP_CHANGED: { NetworkRequest request = getNetworkRequest(message); - NetworkCallbacks callbacks = getCallbacks(request); + NetworkCallbackListener callbacks = getCallbacks(request); if (callbacks != null) { Network network = getNetwork(message); LinkProperties lp = mCm.getLinkProperties(network); @@ -1843,7 +1889,7 @@ public class ConnectivityManager { } case CALLBACK_RELEASED: { NetworkRequest req = (NetworkRequest)message.obj; - NetworkCallbacks callbacks = null; + NetworkCallbackListener callbacks = null; synchronized(mCallbackMap) { callbacks = mCallbackMap.remove(req); } @@ -1870,7 +1916,7 @@ public class ConnectivityManager { private NetworkRequest getNetworkRequest(Message msg) { return (NetworkRequest)(msg.obj); } - private NetworkCallbacks getCallbacks(NetworkRequest req) { + private NetworkCallbackListener getCallbacks(NetworkRequest req) { synchronized(mCallbackMap) { return mCallbackMap.get(req); } @@ -1878,7 +1924,7 @@ public class ConnectivityManager { private Network getNetwork(Message msg) { return new Network(msg.arg2); } - private NetworkCallbacks removeCallbacks(Message msg) { + private NetworkCallbackListener removeCallbacks(Message msg) { NetworkRequest req = (NetworkRequest)msg.obj; synchronized(mCallbackMap) { return mCallbackMap.remove(req); @@ -1893,7 +1939,7 @@ public class ConnectivityManager { HandlerThread callbackThread = new HandlerThread("ConnectivityManager"); callbackThread.start(); sCallbackHandler = new CallbackHandler(callbackThread.getLooper(), - sNetworkCallbacks, sCallbackRefCount, this); + sNetworkCallbackListener, sCallbackRefCount, this); } } } @@ -1907,8 +1953,8 @@ public class ConnectivityManager { } } - static final HashMap<NetworkRequest, NetworkCallbacks> sNetworkCallbacks = - new HashMap<NetworkRequest, NetworkCallbacks>(); + static final HashMap<NetworkRequest, NetworkCallbackListener> sNetworkCallbackListener = + new HashMap<NetworkRequest, NetworkCallbackListener>(); static final AtomicInteger sCallbackRefCount = new AtomicInteger(0); static CallbackHandler sCallbackHandler = null; @@ -1916,9 +1962,11 @@ public class ConnectivityManager { private final static int REQUEST = 2; private NetworkRequest somethingForNetwork(NetworkCapabilities need, - NetworkCallbacks networkCallbacks, int timeoutSec, int action) { + NetworkCallbackListener networkCallbackListener, int timeoutSec, int action) { NetworkRequest networkRequest = null; - if (networkCallbacks == null) throw new IllegalArgumentException("null NetworkCallbacks"); + if (networkCallbackListener == null) { + throw new IllegalArgumentException("null NetworkCallbackListener"); + } if (need == null) throw new IllegalArgumentException("null NetworkCapabilities"); try { addCallbackListener(); @@ -1930,8 +1978,8 @@ public class ConnectivityManager { timeoutSec, new Binder()); } if (networkRequest != null) { - synchronized(sNetworkCallbacks) { - sNetworkCallbacks.put(networkRequest, networkCallbacks); + synchronized(sNetworkCallbackListener) { + sNetworkCallbackListener.put(networkRequest, networkCallbackListener); } } } catch (RemoteException e) {} @@ -1943,46 +1991,44 @@ public class ConnectivityManager { * Request a network to satisfy a set of {@link NetworkCapabilities}. * * This {@link NetworkRequest} will live until released via - * {@link releaseNetworkRequest} or the calling application exits. - * Status of the request can be follwed by listening to the various - * callbacks described in {@link NetworkCallbacks}. The {@link Network} - * can be used by using the {@link bindSocketToNetwork}, - * {@link bindApplicationToNetwork} and {@link getAddrInfoOnNetwork} functions. + * {@link #releaseNetworkRequest} or the calling application exits. + * Status of the request can be followed by listening to the various + * callbacks described in {@link NetworkCallbackListener}. The {@link Network} + * can be used to direct traffic to the network. * * @param need {@link NetworkCapabilities} required by this request. - * @param networkCallbacks The callbacks to be utilized for this request. Note - * the callbacks can be shared by multiple requests and - * the NetworkRequest token utilized to determine to which - * request the callback relates. + * @param networkCallbackListener The {@link NetworkCallbackListener} to be utilized for this + * request. Note the callbacks can be shared by multiple + * requests and the NetworkRequest token utilized to + * determine to which request the callback relates. * @return A {@link NetworkRequest} object identifying the request. - * @hide */ public NetworkRequest requestNetwork(NetworkCapabilities need, - NetworkCallbacks networkCallbacks) { - return somethingForNetwork(need, networkCallbacks, 0, REQUEST); + NetworkCallbackListener networkCallbackListener) { + return somethingForNetwork(need, networkCallbackListener, 0, REQUEST); } /** * Request a network to satisfy a set of {@link NetworkCapabilities}, limited * by a timeout. * - * This function behaves identically, but if a suitable network is not found - * within the given time (in Seconds) the {@link NetworkCallbacks#unavailable} - * callback is called. The request must still be released normally by - * calling {@link releaseNetworkRequest}. + * This function behaves identically to the non-timedout version, but if a suitable + * network is not found within the given time (in Seconds) the + * {@link NetworkCallbackListener#unavailable} callback is called. The request must + * still be released normally by calling {@link releaseNetworkRequest}. * @param need {@link NetworkCapabilities} required by this request. - * @param networkCallbacks The callbacks to be utilized for this request. Note + * @param networkCallbackListener The callbacks to be utilized for this request. Note * the callbacks can be shared by multiple requests and * the NetworkRequest token utilized to determine to which * request the callback relates. * @param timeoutSec The time in seconds to attempt looking for a suitable network - * before {@link NetworkCallbacks#unavailable} is called. + * before {@link NetworkCallbackListener#unavailable} is called. * @return A {@link NetworkRequest} object identifying the request. * @hide */ public NetworkRequest requestNetwork(NetworkCapabilities need, - NetworkCallbacks networkCallbacks, int timeoutSec) { - return somethingForNetwork(need, networkCallbacks, timeoutSec, REQUEST); + NetworkCallbackListener networkCallbackListener, int timeoutSec) { + return somethingForNetwork(need, networkCallbackListener, timeoutSec, REQUEST); } /** @@ -1993,36 +2039,52 @@ public class ConnectivityManager { public final static int MAX_NETWORK_REQUEST_TIMEOUT_SEC = 100 * 60; /** + * The lookup key for a {@link Network} object included with the intent after + * succesfully finding a network for the applications request. Retrieve it with + * {@link android.content.Intent#getParcelableExtra(String)}. + */ + public static final String EXTRA_NETWORK_REQUEST_NETWORK = "networkRequestNetwork"; + + /** + * The lookup key for a {@link NetworkCapabilities} object included with the intent after + * succesfully finding a network for the applications request. Retrieve it with + * {@link android.content.Intent#getParcelableExtra(String)}. + */ + public static final String EXTRA_NETWORK_REQUEST_NETWORK_CAPABILITIES = + "networkRequestNetworkCapabilities"; + + + /** * Request a network to satisfy a set of {@link NetworkCapabilities}. * - * This function behavies identically, but instead of {@link NetworkCallbacks} - * a {@link PendingIntent} is used. This means the request may outlive the - * calling application and get called back when a suitable network is found. + * This function behavies identically to the callback-equiped version, but instead + * of {@link NetworkCallbackListener} a {@link PendingIntent} is used. This means + * the request may outlive the calling application and get called back when a suitable + * network is found. * <p> * The operation is an Intent broadcast that goes to a broadcast receiver that * you registered with {@link Context#registerReceiver} or through the * <receiver> tag in an AndroidManifest.xml file * <p> * The operation Intent is delivered with two extras, a {@link Network} typed - * extra called {@link EXTRA_NETWORK_REQUEST_NETWORK} and a {@link NetworkCapabilities} - * typed extra called {@link EXTRA_NETWORK_REQUEST_NETWORK_CAPABILTIES} containing + * extra called {@link #EXTRA_NETWORK_REQUEST_NETWORK} and a {@link NetworkCapabilities} + * typed extra called {@link #EXTRA_NETWORK_REQUEST_NETWORK_CAPABILITIES} containing * the original requests parameters. It is important to create a new, - * {@link NetworkCallbacks} based request before completing the processing of the + * {@link NetworkCallbackListener} based request before completing the processing of the * Intent to reserve the network or it will be released shortly after the Intent * is processed. * <p> * If there is already an request for this Intent registered (with the equality of * two Intents defined by {@link Intent#filterEquals}), then it will be removed and - * replace by this one, effectively releasing the previous {@link NetworkRequest}. + * replaced by this one, effectively releasing the previous {@link NetworkRequest}. * <p> - * The request may be released normally by calling {@link releaseNetworkRequest}. + * The request may be released normally by calling {@link #releaseNetworkRequest}. * - * @param need {@link NetworkCapabilties} required by this request. + * @param need {@link NetworkCapabilities} required by this request. * @param operation Action to perform when the network is available (corresponds - * to the {@link NetworkCallbacks#onAvailable} call. Typically + * to the {@link NetworkCallbackListener#onAvailable} call. Typically * comes from {@link PendingIntent#getBroadcast}. * @return A {@link NetworkRequest} object identifying the request. - * @hide */ public NetworkRequest requestNetwork(NetworkCapabilities need, PendingIntent operation) { try { @@ -2035,28 +2097,27 @@ public class ConnectivityManager { * Registers to receive notifications about all networks which satisfy the given * {@link NetworkCapabilities}. The callbacks will continue to be called until * either the application exits or the request is released using - * {@link releaseNetworkRequest}. + * {@link #releaseNetworkRequest}. * * @param need {@link NetworkCapabilities} required by this request. - * @param networkCallbacks The {@link NetworkCallbacks} to be called as suitable + * @param networkCallbackListener The {@link NetworkCallbackListener} to be called as suitable * networks change state. * @return A {@link NetworkRequest} object identifying the request. - * @hide */ public NetworkRequest listenForNetwork(NetworkCapabilities need, - NetworkCallbacks networkCallbacks) { - return somethingForNetwork(need, networkCallbacks, 0, LISTEN); + NetworkCallbackListener networkCallbackListener) { + return somethingForNetwork(need, networkCallbackListener, 0, LISTEN); } /** - * Releases a {NetworkRequest} generated either through a {@link requestNetwork} - * or a {@link listenForNetwork} call. The {@link NetworkCallbacks} given in the - * earlier call may continue receiving calls until the {@link NetworkCallbacks#onReleased} - * function is called, signifiying the end of the request. + * Releases a {@link NetworkRequest} generated either through a {@link #requestNetwork} + * or a {@link #listenForNetwork} call. The {@link NetworkCallbackListener} given in the + * earlier call may continue receiving calls until the + * {@link NetworkCallbackListener#onReleased} function is called, signifying the end + * of the request. * * @param networkRequest The {@link NetworkRequest} generated by an earlier call to - * {@link requestNetwork} or {@link listenForNetwork}. - * @hide + * {@link #requestNetwork} or {@link #listenForNetwork}. */ public void releaseNetworkRequest(NetworkRequest networkRequest) { if (networkRequest == null) throw new IllegalArgumentException("null NetworkRequest"); diff --git a/core/java/android/net/Network.java b/core/java/android/net/Network.java index a99da78..e0d69e3 100644 --- a/core/java/android/net/Network.java +++ b/core/java/android/net/Network.java @@ -26,11 +26,10 @@ import javax.net.SocketFactory; /** * Identifies a {@code Network}. This is supplied to applications via - * {@link ConnectivityManager#NetworkCallbacks} in response to + * {@link ConnectivityManager.NetworkCallbackListener} in response to * {@link ConnectivityManager#requestNetwork} or {@link ConnectivityManager#listenForNetwork}. * It is used to direct traffic to the given {@code Network}, either on a {@link Socket} basis * through a targeted {@link SocketFactory} or process-wide via {@link #bindProcess}. - * @hide */ public class Network implements Parcelable { diff --git a/core/java/android/net/NetworkRequest.java b/core/java/android/net/NetworkRequest.java index 80074a5..480cb05 100644 --- a/core/java/android/net/NetworkRequest.java +++ b/core/java/android/net/NetworkRequest.java @@ -22,18 +22,18 @@ import android.os.Parcelable; import java.util.concurrent.atomic.AtomicInteger; /** - * Defines a request for a network, made by calling {@link ConnectivityManager.requestNetwork}. + * Defines a request for a network, made by calling {@link ConnectivityManager#requestNetwork} + * or {@link ConnectivityManager#listenForNetwork}. * * This token records the {@link NetworkCapabilities} used to make the request and identifies * the request. It should be used to release the request via - * {@link ConnectivityManager.releaseNetworkRequest} when the network is no longer desired. - * @hide + * {@link ConnectivityManager#releaseNetworkRequest} when the network is no longer desired. */ public class NetworkRequest implements Parcelable { /** * The {@link NetworkCapabilities} that define this request. This should not be modified. * The networkCapabilities of the request are set when - * {@link ConnectivityManager.requestNetwork} is called and the value is presented here + * {@link ConnectivityManager#requestNetwork} is called and the value is presented here * as a convenient reminder of what was requested. */ public final NetworkCapabilities networkCapabilities; diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index e896063..2d03e1d 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -1088,6 +1088,9 @@ public final class Settings { MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_COUNT); MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_DELAY_MS); MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS); + + // At one time in System, then Global, but now back in Secure + MOVED_TO_SECURE.add(Secure.INSTALL_NON_MARKET_APPS); } private static final HashSet<String> MOVED_TO_GLOBAL; @@ -1102,7 +1105,6 @@ public final class Settings { MOVED_TO_SECURE_THEN_GLOBAL.add(Global.BLUETOOTH_ON); MOVED_TO_SECURE_THEN_GLOBAL.add(Global.DATA_ROAMING); MOVED_TO_SECURE_THEN_GLOBAL.add(Global.DEVICE_PROVISIONED); - MOVED_TO_SECURE_THEN_GLOBAL.add(Global.INSTALL_NON_MARKET_APPS); MOVED_TO_SECURE_THEN_GLOBAL.add(Global.USB_MASS_STORAGE_ENABLED); MOVED_TO_SECURE_THEN_GLOBAL.add(Global.HTTP_PROXY); @@ -2573,10 +2575,10 @@ public final class Settings { public static final String HTTP_PROXY = Global.HTTP_PROXY; /** - * @deprecated Use {@link android.provider.Settings.Global#INSTALL_NON_MARKET_APPS} instead + * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead */ @Deprecated - public static final String INSTALL_NON_MARKET_APPS = Global.INSTALL_NON_MARKET_APPS; + public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS; /** * @deprecated Use {@link android.provider.Settings.Secure#LOCATION_PROVIDERS_ALLOWED} @@ -2814,7 +2816,6 @@ public final class Settings { MOVED_TO_GLOBAL.add(Settings.Global.DISPLAY_SIZE_FORCED); MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_MAX_BYTES_OVER_MOBILE); MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE); - MOVED_TO_GLOBAL.add(Settings.Global.INSTALL_NON_MARKET_APPS); MOVED_TO_GLOBAL.add(Settings.Global.MOBILE_DATA); MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_BUCKET_DURATION); MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_DELETE_AGE); @@ -3404,10 +3405,13 @@ public final class Settings { public static final String HTTP_PROXY = Global.HTTP_PROXY; /** - * @deprecated Use {@link android.provider.Settings.Global#INSTALL_NON_MARKET_APPS} instead + * Whether applications can be installed for this user via the system's + * {@link Intent#ACTION_INSTALL_PACKAGE} mechanism. + * + * <p>1 = permit app installation via the system package installer intent + * <p>0 = do not allow use of the package installer */ - @Deprecated - public static final String INSTALL_NON_MARKET_APPS = Global.INSTALL_NON_MARKET_APPS; + public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps"; /** * Comma-separated list of location providers that activities may access. Do not rely on @@ -5066,13 +5070,10 @@ public final class Settings { "download_manager_recommended_max_bytes_over_mobile"; /** - * Whether the package installer should allow installation of apps downloaded from - * sources other than Google Play. - * - * 1 = allow installing from other sources - * 0 = only allow installing from Google Play + * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead */ - public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps"; + @Deprecated + public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS; /** * Whether mobile data connections are allowed by the user. See @@ -6238,6 +6239,13 @@ public final class Settings { CALL_METHOD_GET_GLOBAL, CALL_METHOD_PUT_GLOBAL); + // Certain settings have been moved from global to the per-user secure namespace + private static final HashSet<String> MOVED_TO_SECURE; + static { + MOVED_TO_SECURE = new HashSet<String>(1); + MOVED_TO_SECURE.add(Settings.Global.INSTALL_NON_MARKET_APPS); + } + /** * Look up a name in the database. * @param resolver to access the database with @@ -6251,6 +6259,11 @@ public final class Settings { /** @hide */ public static String getStringForUser(ContentResolver resolver, String name, int userHandle) { + if (MOVED_TO_SECURE.contains(name)) { + Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Global" + + " to android.provider.Settings.Secure, returning read-only value."); + return Secure.getStringForUser(resolver, name, userHandle); + } return sNameValueCache.getStringForUser(resolver, name, userHandle); } @@ -6273,6 +6286,12 @@ public final class Settings { Log.v(TAG, "Global.putString(name=" + name + ", value=" + value + " for " + userHandle); } + // Global and Secure have the same access policy so we can forward writes + if (MOVED_TO_SECURE.contains(name)) { + Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Global" + + " to android.provider.Settings.Secure, value is unchanged."); + return Secure.putStringForUser(resolver, name, value, userHandle); + } return sNameValueCache.putStringForUser(resolver, name, value, userHandle); } diff --git a/core/java/android/view/InputDevice.java b/core/java/android/view/InputDevice.java index ae5f37e..358ae8a 100644 --- a/core/java/android/view/InputDevice.java +++ b/core/java/android/view/InputDevice.java @@ -234,6 +234,14 @@ public final class InputDevice implements Parcelable { public static final int SOURCE_JOYSTICK = 0x01000000 | SOURCE_CLASS_JOYSTICK; /** + * The input source is a device connected through HDMI-based bus. + * + * The key comes in through HDMI-CEC or MHL signal line, and is treated as if it were + * generated by a locally connected DPAD or keyboard. + */ + public static final int SOURCE_HDMI = 0x02000000 | SOURCE_CLASS_BUTTON; + + /** * A special input source constant that is used when filtering input devices * to match devices that provide any type of input source. */ diff --git a/core/java/android/view/KeyEvent.java b/core/java/android/view/KeyEvent.java index b8e1b89..8a996d2 100644 --- a/core/java/android/view/KeyEvent.java +++ b/core/java/android/view/KeyEvent.java @@ -644,14 +644,26 @@ public class KeyEvent extends InputEvent implements Parcelable { * devices or game controllers, especially if no other input mode is * available. */ public static final int KEYCODE_PAIRING = 225; - - private static final int LAST_KEYCODE = KEYCODE_PAIRING; + /** Key code constant: Media Top Menu key. + * Goes to the top of media menu. */ + public static final int KEYCODE_MEDIA_TOP_MENU = 226; + /** Key code constant: '11' key. */ + public static final int KEYCODE_11 = 227; + /** Key code constant: '12' key. */ + public static final int KEYCODE_12 = 228; + /** Key code constant: Last Channel key. + * Goes to the last viewed channel. */ + public static final int KEYCODE_LAST_CHANNEL = 229; + /** Key code constant: TV data service key. + * Displays data services like weather, sports. */ + public static final int KEYCODE_TV_DATA_SERVICE = 230; + + private static final int LAST_KEYCODE = KEYCODE_TV_DATA_SERVICE; // NOTE: If you add a new keycode here you must also add it to: // isSystem() // frameworks/native/include/android/keycodes.h - // frameworks/base/include/androidfw/InputEventAttributes.h - // external/webkit/WebKit/android/plugins/ANPKeyCodes.h + // frameworks/native/include/input/InputEventLabels.h // frameworks/base/core/res/res/values/attrs.xml // emulator? // LAST_KEYCODE diff --git a/core/java/android/view/ThreadedRenderer.java b/core/java/android/view/ThreadedRenderer.java index 74972c2..afd9569 100644 --- a/core/java/android/view/ThreadedRenderer.java +++ b/core/java/android/view/ThreadedRenderer.java @@ -193,9 +193,11 @@ public class ThreadedRenderer extends HardwareRenderer { Trace.traceBegin(Trace.TRACE_TAG_VIEW, "getDisplayList"); HardwareCanvas canvas = mRootNode.start(mWidth, mHeight); try { + canvas.save(); callbacks.onHardwarePreDraw(canvas); canvas.drawDisplayList(view.getDisplayList()); callbacks.onHardwarePostDraw(canvas); + canvas.restore(); } finally { mRootNode.end(canvas); Trace.traceEnd(Trace.TRACE_TAG_VIEW); diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index fb7d57d..6dc7286 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -4789,25 +4789,23 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @param v previous or the next focus holder, or null if none */ private void manageFocusHotspot(boolean focused, View v) { - if (mBackground != null && mBackground.supportsHotspots()) { - final Rect r = new Rect(); - if (!focused && v != null) { - v.getBoundsOnScreen(r); - final int[] location = new int[2]; - getLocationOnScreen(location); - r.offset(-location[0], -location[1]); - } else { - r.set(0, 0, mRight - mLeft, mBottom - mTop); - } - - final float x = r.exactCenterX(); - final float y = r.exactCenterY(); - mBackground.setHotspot(R.attr.state_focused, x, y); + if (mBackground == null) { + return; + } - if (!focused) { - mBackground.removeHotspot(R.attr.state_focused); - } + final Rect r = new Rect(); + if (!focused && v != null) { + v.getBoundsOnScreen(r); + final int[] location = new int[2]; + getLocationOnScreen(location); + r.offset(-location[0], -location[1]); + } else { + r.set(0, 0, mRight - mLeft, mBottom - mTop); } + + final float x = r.exactCenterX(); + final float y = r.exactCenterY(); + mBackground.setHotspot(x, y); } /** @@ -6763,7 +6761,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ private void setPressed(boolean pressed, float x, float y) { if (pressed) { - setHotspot(R.attr.state_pressed, x, y); + setHotspot(x, y); } setPressed(pressed); @@ -6787,10 +6785,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mPrivateFlags &= ~PFLAG_PRESSED; } - if (!pressed) { - clearHotspot(R.attr.state_pressed); - } - if (needsRefresh) { refreshDrawableState(); } @@ -9106,21 +9100,20 @@ public class View implements Drawable.Callback, KeyEvent.Callback, postDelayed(mPendingCheckForTap, ViewConfiguration.getTapTimeout()); } else { // Not inside a scrolling container, so show the feedback right away - setHotspot(R.attr.state_pressed, x, y); + setHotspot(x, y); setPressed(true); checkForLongClick(0); } break; case MotionEvent.ACTION_CANCEL: - clearHotspot(R.attr.state_pressed); setPressed(false); removeTapCallback(); removeLongPressCallback(); break; case MotionEvent.ACTION_MOVE: - setHotspot(R.attr.state_pressed, x, y); + setHotspot(x, y); // Be lenient about moving outside of buttons if (!pointInView(x, y, mTouchSlop)) { @@ -9142,17 +9135,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, return false; } - private void setHotspot(int id, float x, float y) { - final Drawable bg = mBackground; - if (bg != null && bg.supportsHotspots()) { - bg.setHotspot(id, x, y); - } - } - - private void clearHotspot(int id) { - final Drawable bg = mBackground; - if (bg != null && bg.supportsHotspots()) { - bg.removeHotspot(id); + private void setHotspot(float x, float y) { + if (mBackground != null) { + mBackground.setHotspot(x, y); } } @@ -12903,10 +12888,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mPrivateFlags &= ~PFLAG_CANCEL_NEXT_UP_EVENT; mPrivateFlags3 &= ~PFLAG3_IS_LAID_OUT; - if (mBackground != null) { - mBackground.clearHotspots(); - } - removeUnsetPressCallback(); removeLongPressCallback(); removePerformClickCallback(); diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index f91ef1a..c9eb130 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -2502,22 +2502,16 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te positionSelector(position, sel); final Drawable selector = mSelector; - if (selector != null && selector.supportsHotspots() && position != INVALID_POSITION) { + if (selector != null && position != INVALID_POSITION) { final Rect bounds = mSelectorRect; final float x = bounds.exactCenterX(); final float y = bounds.exactCenterY(); - selector.setHotspot(R.attr.state_focused, x, y); + selector.setHotspot(x, y); } } void positionSelector(int position, View sel) { if (position != INVALID_POSITION) { - if (mSelectorPosition != position) { - final Drawable selector = mSelector; - if (selector != null && selector.supportsHotspots()) { - selector.clearHotspots(); - } - } mSelectorPosition = position; } @@ -3245,9 +3239,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te ((TransitionDrawable) d).resetTransition(); } } - if (d.supportsHotspots()) { - d.setHotspot(R.attr.state_pressed, x, y); - } + d.setHotspot(x, y); } if (longClickable) { @@ -3783,9 +3775,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te if (d != null && d instanceof TransitionDrawable) { ((TransitionDrawable) d).resetTransition(); } - if (mSelector.supportsHotspots()) { - mSelector.setHotspot(R.attr.state_pressed, x, ev.getY()); - } + mSelector.setHotspot(x, ev.getY()); } if (mTouchModeReset != null) { removeCallbacks(mTouchModeReset); @@ -3797,9 +3787,6 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te mTouchMode = TOUCH_MODE_REST; child.setPressed(false); setPressed(false); - if (mSelector != null && mSelector.supportsHotspots()) { - mSelector.removeHotspot(R.attr.state_pressed); - } if (!mDataChanged && !mIsDetaching && isAttachedToWindow()) { performClick.run(); } diff --git a/core/java/android/widget/AbsSeekBar.java b/core/java/android/widget/AbsSeekBar.java index 4f2d9c6..1152e17 100644 --- a/core/java/android/widget/AbsSeekBar.java +++ b/core/java/android/widget/AbsSeekBar.java @@ -31,8 +31,6 @@ import android.view.ViewConfiguration; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; -import com.android.internal.R; - public abstract class AbsSeekBar extends ProgressBar { private final Rect mTempRect = new Rect(); @@ -348,7 +346,7 @@ public abstract class AbsSeekBar extends ProgressBar { final int right = left + thumbWidth; final Drawable background = getBackground(); - if (background != null && background.supportsHotspots()) { + if (background != null) { final Rect bounds = mThumb.getBounds(); final int offsetX = mPaddingLeft - mThumbOffset; final int offsetY = mPaddingTop; @@ -499,17 +497,10 @@ public abstract class AbsSeekBar extends ProgressBar { return true; } - private void setHotspot(int id, float x, float y) { - final Drawable bg = getBackground(); - if (bg != null && bg.supportsHotspots()) { - bg.setHotspot(id, x, y); - } - } - - private void clearHotspot(int id) { + private void setHotspot(float x, float y) { final Drawable bg = getBackground(); - if (bg != null && bg.supportsHotspots()) { - bg.removeHotspot(id); + if (bg != null) { + bg.setHotspot(x, y); } } @@ -541,7 +532,7 @@ public abstract class AbsSeekBar extends ProgressBar { final int max = getMax(); progress += scale * max; - setHotspot(R.attr.state_pressed, x, (int) event.getY()); + setHotspot(x, (int) event.getY()); setProgress((int) progress, true); } @@ -567,7 +558,6 @@ public abstract class AbsSeekBar extends ProgressBar { * canceled. */ void onStopTrackingTouch() { - clearHotspot(R.attr.state_pressed); mIsDragging = false; } diff --git a/core/java/android/widget/CompoundButton.java b/core/java/android/widget/CompoundButton.java index 9e17cca..6aff4f4 100644 --- a/core/java/android/widget/CompoundButton.java +++ b/core/java/android/widget/CompoundButton.java @@ -285,7 +285,7 @@ public abstract class CompoundButton extends Button implements Checkable { buttonDrawable.setBounds(left, top, right, bottom); final Drawable background = getBackground(); - if (background != null && background.supportsHotspots()) { + if (background != null) { background.setHotspotBounds(left, top, right, bottom); } } diff --git a/core/java/android/widget/Switch.java b/core/java/android/widget/Switch.java index 74a3eec..ad1a023 100644 --- a/core/java/android/widget/Switch.java +++ b/core/java/android/widget/Switch.java @@ -828,7 +828,7 @@ public class Switch extends CompoundButton { thumbDrawable.setBounds(thumbLeft, switchTop, thumbRight, switchBottom); final Drawable background = getBackground(); - if (background != null && background.supportsHotspots()) { + if (background != null) { background.setHotspotBounds(thumbLeft, switchTop, thumbRight, switchBottom); } diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 8f073de..a4a9680 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -8194,7 +8194,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener final boolean isPassword = hasPasswordTransformationMethod(); info.setPassword(isPassword); - if (!isPassword) { + if (!isPassword || shouldSpeakPasswordsForAccessibility()) { info.setText(getTextForAccessibility()); } diff --git a/core/java/com/android/internal/statusbar/IStatusBar.aidl b/core/java/com/android/internal/statusbar/IStatusBar.aidl index 8fa662d..1366499 100644 --- a/core/java/com/android/internal/statusbar/IStatusBar.aidl +++ b/core/java/com/android/internal/statusbar/IStatusBar.aidl @@ -39,7 +39,7 @@ oneway interface IStatusBar void setWindowState(int window, int state); void showRecentApps(boolean triggeredFromAltTab); - void hideRecentApps(); + void hideRecentApps(boolean triggeredFromAltTab); void toggleRecentApps(); void preloadRecentApps(); void cancelPreloadRecentApps(); diff --git a/core/java/com/android/internal/statusbar/IStatusBarService.aidl b/core/java/com/android/internal/statusbar/IStatusBarService.aidl index 9ebfd78..2d6cf2e 100644 --- a/core/java/com/android/internal/statusbar/IStatusBarService.aidl +++ b/core/java/com/android/internal/statusbar/IStatusBarService.aidl @@ -55,7 +55,7 @@ interface IStatusBarService void setWindowState(int window, int state); void showRecentApps(boolean triggeredFromAltTab); - void hideRecentApps(); + void hideRecentApps(boolean triggeredFromAltTab); void toggleRecentApps(); void preloadRecentApps(); void cancelPreloadRecentApps(); |
