Merge "Actually end animators on tree destruction" into lmp-dev
diff --git a/api/current.txt b/api/current.txt
index 2ff971b..c96213d 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -7148,6 +7148,7 @@
field public static final java.lang.String ANY_CURSOR_ITEM_TYPE = "vnd.android.cursor.item/*";
field public static final java.lang.String CURSOR_DIR_BASE_TYPE = "vnd.android.cursor.dir";
field public static final java.lang.String CURSOR_ITEM_BASE_TYPE = "vnd.android.cursor.item";
+ field public static final java.lang.String EXTRA_SIZE = "android.content.extra.SIZE";
field public static final java.lang.String SCHEME_ANDROID_RESOURCE = "android.resource";
field public static final java.lang.String SCHEME_CONTENT = "content";
field public static final java.lang.String SCHEME_FILE = "file";
@@ -32234,17 +32235,23 @@
field public static final android.util.Rational ZERO;
}
- public final class Size {
+ public final class Size implements android.os.Parcelable {
ctor public Size(int, int);
+ method public int describeContents();
method public int getHeight();
method public int getWidth();
method public static android.util.Size parseSize(java.lang.String) throws java.lang.NumberFormatException;
+ method public void writeToParcel(android.os.Parcel, int);
+ field public static final android.os.Parcelable.Creator CREATOR;
}
- public final class SizeF {
+ public final class SizeF implements android.os.Parcelable {
ctor public SizeF(float, float);
+ method public int describeContents();
method public float getHeight();
method public float getWidth();
+ method public void writeToParcel(android.os.Parcel, int);
+ field public static final android.os.Parcelable.Creator CREATOR;
}
public class SparseArray implements java.lang.Cloneable {
diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java
index b13792b..b2b48e8 100644
--- a/core/java/android/content/ContentResolver.java
+++ b/core/java/android/content/ContentResolver.java
@@ -27,6 +27,7 @@
import android.database.CrossProcessCursorWrapper;
import android.database.Cursor;
import android.database.IContentObserver;
+import android.graphics.Point;
import android.net.Uri;
import android.os.Bundle;
import android.os.CancellationSignal;
@@ -161,6 +162,17 @@
public static final String SCHEME_FILE = "file";
/**
+ * An extra {@link Point} describing the optimal size for a requested image
+ * resource, in pixels. If a provider has multiple sizes of the image, it
+ * should return the image closest to this size.
+ *
+ * @see #openTypedAssetFileDescriptor(Uri, String, Bundle)
+ * @see #openTypedAssetFileDescriptor(Uri, String, Bundle,
+ * CancellationSignal)
+ */
+ public static final String EXTRA_SIZE = "android.content.extra.SIZE";
+
+ /**
* This is the Android platform's base MIME type for a content: URI
* containing a Cursor of a single item. Applications should use this
* as the base type along with their own sub-type of their content: URIs
diff --git a/core/java/android/net/NetworkAgent.java b/core/java/android/net/NetworkAgent.java
index 22da90e..8df9916 100644
--- a/core/java/android/net/NetworkAgent.java
+++ b/core/java/android/net/NetworkAgent.java
@@ -45,7 +45,7 @@
private volatile AsyncChannel mAsyncChannel;
private final String LOG_TAG;
private static final boolean DBG = true;
- private static final boolean VDBG = true;
+ private static final boolean VDBG = false;
private final Context mContext;
private final ArrayList<Message>mPreConnectedQueue = new ArrayList<Message>();
@@ -134,7 +134,7 @@
throw new IllegalArgumentException();
}
- if (DBG) log("Registering NetworkAgent");
+ if (VDBG) log("Registering NetworkAgent");
ConnectivityManager cm = (ConnectivityManager)mContext.getSystemService(
Context.CONNECTIVITY_SERVICE);
cm.registerNetworkAgent(new Messenger(this), new NetworkInfo(ni),
@@ -148,7 +148,7 @@
if (mAsyncChannel != null) {
log("Received new connection while already connected!");
} else {
- if (DBG) log("NetworkAgent fully connected");
+ if (VDBG) log("NetworkAgent fully connected");
AsyncChannel ac = new AsyncChannel();
ac.connected(null, this, msg.replyTo);
ac.replyToMessage(msg, AsyncChannel.CMD_CHANNEL_FULLY_CONNECTED,
@@ -164,7 +164,7 @@
break;
}
case AsyncChannel.CMD_CHANNEL_DISCONNECT: {
- if (DBG) log("CMD_CHANNEL_DISCONNECT");
+ if (VDBG) log("CMD_CHANNEL_DISCONNECT");
if (mAsyncChannel != null) mAsyncChannel.disconnect();
break;
}
diff --git a/core/java/android/net/NetworkFactory.java b/core/java/android/net/NetworkFactory.java
index a20e8e7..6ddd8b3 100644
--- a/core/java/android/net/NetworkFactory.java
+++ b/core/java/android/net/NetworkFactory.java
@@ -46,6 +46,7 @@
**/
public class NetworkFactory extends Handler {
private static final boolean DBG = true;
+ private static final boolean VDBG = false;
private static final int BASE = Protocol.BASE_NETWORK_FACTORY;
/**
@@ -164,13 +165,14 @@
private void handleAddRequest(NetworkRequest request, int score) {
NetworkRequestInfo n = mNetworkRequests.get(request.requestId);
if (n == null) {
+ if (DBG) log("got request " + request + " with score " + score);
n = new NetworkRequestInfo(request, score);
mNetworkRequests.put(n.request.requestId, n);
} else {
+ if (VDBG) log("new score " + score + " for exisiting request " + request);
n.score = score;
}
- if (DBG) log("got request " + request + " with score " + score);
- if (DBG) log(" my score=" + mScore + ", my filter=" + mCapabilityFilter);
+ if (VDBG) log(" my score=" + mScore + ", my filter=" + mCapabilityFilter);
evalRequest(n);
}
diff --git a/core/java/android/provider/DocumentsContract.java b/core/java/android/provider/DocumentsContract.java
index 327fe4a..9a0858a 100644
--- a/core/java/android/provider/DocumentsContract.java
+++ b/core/java/android/provider/DocumentsContract.java
@@ -511,8 +511,6 @@
public static final String METHOD_DELETE_DOCUMENT = "android:deleteDocument";
/** {@hide} */
- public static final String EXTRA_THUMBNAIL_SIZE = "thumbnail_size";
- /** {@hide} */
public static final String EXTRA_URI = "uri";
private static final String PATH_ROOT = "root";
@@ -819,7 +817,7 @@
ContentProviderClient client, Uri documentUri, Point size, CancellationSignal signal)
throws RemoteException, IOException {
final Bundle openOpts = new Bundle();
- openOpts.putParcelable(DocumentsContract.EXTRA_THUMBNAIL_SIZE, size);
+ openOpts.putParcelable(ContentResolver.EXTRA_SIZE, size);
AssetFileDescriptor afd = null;
Bitmap bitmap = null;
diff --git a/core/java/android/provider/DocumentsProvider.java b/core/java/android/provider/DocumentsProvider.java
index 021fff4..270d786 100644
--- a/core/java/android/provider/DocumentsProvider.java
+++ b/core/java/android/provider/DocumentsProvider.java
@@ -16,7 +16,6 @@
package android.provider;
-import static android.provider.DocumentsContract.EXTRA_THUMBNAIL_SIZE;
import static android.provider.DocumentsContract.METHOD_CREATE_DOCUMENT;
import static android.provider.DocumentsContract.METHOD_DELETE_DOCUMENT;
import static android.provider.DocumentsContract.METHOD_RENAME_DOCUMENT;
@@ -763,8 +762,8 @@
public final AssetFileDescriptor openTypedAssetFile(Uri uri, String mimeTypeFilter, Bundle opts)
throws FileNotFoundException {
enforceTree(uri);
- if (opts != null && opts.containsKey(EXTRA_THUMBNAIL_SIZE)) {
- final Point sizeHint = opts.getParcelable(EXTRA_THUMBNAIL_SIZE);
+ if (opts != null && opts.containsKey(ContentResolver.EXTRA_SIZE)) {
+ final Point sizeHint = opts.getParcelable(ContentResolver.EXTRA_SIZE);
return openDocumentThumbnail(getDocumentId(uri), sizeHint, null);
} else {
return super.openTypedAssetFile(uri, mimeTypeFilter, opts);
@@ -781,8 +780,8 @@
Uri uri, String mimeTypeFilter, Bundle opts, CancellationSignal signal)
throws FileNotFoundException {
enforceTree(uri);
- if (opts != null && opts.containsKey(EXTRA_THUMBNAIL_SIZE)) {
- final Point sizeHint = opts.getParcelable(EXTRA_THUMBNAIL_SIZE);
+ if (opts != null && opts.containsKey(ContentResolver.EXTRA_SIZE)) {
+ final Point sizeHint = opts.getParcelable(ContentResolver.EXTRA_SIZE);
return openDocumentThumbnail(getDocumentId(uri), sizeHint, signal);
} else {
return super.openTypedAssetFile(uri, mimeTypeFilter, opts, signal);
diff --git a/core/java/android/util/Size.java b/core/java/android/util/Size.java
index d58f778..6424344 100644
--- a/core/java/android/util/Size.java
+++ b/core/java/android/util/Size.java
@@ -16,12 +16,15 @@
package android.util;
-import static com.android.internal.util.Preconditions.*;
+import static com.android.internal.util.Preconditions.checkNotNull;
+
+import android.os.Parcel;
+import android.os.Parcelable;
/**
* Immutable class for describing width and height dimensions in pixels.
*/
-public final class Size {
+public final class Size implements Parcelable {
/**
* Create a new immutable Size instance.
*
@@ -33,6 +36,11 @@
mHeight = height;
}
+ private Size(Parcel in) {
+ mWidth = in.readInt();
+ mHeight = in.readInt();
+ }
+
/**
* Get the width of the size (in pixels).
* @return width
@@ -147,6 +155,29 @@
return mHeight ^ ((mWidth << (Integer.SIZE / 2)) | (mWidth >>> (Integer.SIZE / 2)));
}
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel out, int flags) {
+ out.writeInt(mWidth);
+ out.writeInt(mHeight);
+ }
+
+ public static final Parcelable.Creator<Size> CREATOR = new Parcelable.Creator<Size>() {
+ @Override
+ public Size createFromParcel(Parcel in) {
+ return new Size(in);
+ }
+
+ @Override
+ public Size[] newArray(int size) {
+ return new Size[size];
+ }
+ };
+
private final int mWidth;
private final int mHeight;
-};
+}
diff --git a/core/java/android/util/SizeF.java b/core/java/android/util/SizeF.java
index 0a8b4ed..88bb4393 100644
--- a/core/java/android/util/SizeF.java
+++ b/core/java/android/util/SizeF.java
@@ -16,7 +16,10 @@
package android.util;
-import static com.android.internal.util.Preconditions.*;
+import static com.android.internal.util.Preconditions.checkArgumentFinite;
+
+import android.os.Parcel;
+import android.os.Parcelable;
/**
* Immutable class for describing width and height dimensions in some arbitrary
@@ -25,7 +28,7 @@
* Width and height are finite values stored as a floating point representation.
* </p>
*/
-public final class SizeF {
+public final class SizeF implements Parcelable {
/**
* Create a new immutable SizeF instance.
*
@@ -43,6 +46,11 @@
mHeight = checkArgumentFinite(height, "height");
}
+ private SizeF(Parcel in) {
+ mWidth = in.readFloat();
+ mHeight = in.readFloat();
+ }
+
/**
* Get the width of the size (as an arbitrary unit).
* @return width
@@ -103,6 +111,29 @@
return Float.floatToIntBits(mWidth) ^ Float.floatToIntBits(mHeight);
}
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel out, int flags) {
+ out.writeFloat(mWidth);
+ out.writeFloat(mHeight);
+ }
+
+ public static final Parcelable.Creator<SizeF> CREATOR = new Parcelable.Creator<SizeF>() {
+ @Override
+ public SizeF createFromParcel(Parcel in) {
+ return new SizeF(in);
+ }
+
+ @Override
+ public SizeF[] newArray(int size) {
+ return new SizeF[size];
+ }
+ };
+
private final float mWidth;
private final float mHeight;
-};
+}
diff --git a/core/java/android/view/ViewPropertyAnimator.java b/core/java/android/view/ViewPropertyAnimator.java
index bae0cfb..b73b9fa 100644
--- a/core/java/android/view/ViewPropertyAnimator.java
+++ b/core/java/android/view/ViewPropertyAnimator.java
@@ -430,6 +430,10 @@
}
}
mPendingAnimations.clear();
+ mPendingSetupAction = null;
+ mPendingCleanupAction = null;
+ mPendingOnStartAction = null;
+ mPendingOnEndAction = null;
mView.removeCallbacks(mAnimationStarter);
if (mRTBackend != null) {
mRTBackend.cancelAll();
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 8bb094b..107bb06 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -185,7 +185,7 @@
private static final String TAG = "ConnectivityService";
private static final boolean DBG = true;
- private static final boolean VDBG = true; // STOPSHIP
+ private static final boolean VDBG = false;
// network sampling debugging
private static final boolean SAMPLE_DBG = false;
@@ -830,11 +830,11 @@
// network is blocked; clone and override state
info = new NetworkInfo(info);
info.setDetailedState(DetailedState.BLOCKED, null, null);
- if (VDBG) log("returning Blocked NetworkInfo");
+ if (DBG) log("returning Blocked NetworkInfo");
}
if (mLockdownTracker != null) {
info = mLockdownTracker.augmentNetworkInfo(info);
- if (VDBG) log("returning Locked NetworkInfo");
+ if (DBG) log("returning Locked NetworkInfo");
}
return info;
}
@@ -1202,7 +1202,7 @@
bestRoute = RouteInfo.makeHostRoute(addr, bestRoute.getGateway(), iface);
}
}
- if (VDBG) log("Adding " + bestRoute + " for interface " + bestRoute.getInterface());
+ if (DBG) log("Adding " + bestRoute + " for interface " + bestRoute.getInterface());
try {
mNetd.addLegacyRouteForNetId(netId, bestRoute, uid);
} catch (Exception e) {
@@ -1401,7 +1401,7 @@
mInitialBroadcast = new Intent(intent);
}
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
- if (VDBG) {
+ if (DBG) {
log("sendStickyBroadcast: action=" + intent.getAction());
}
@@ -1558,7 +1558,7 @@
}
try {
- if (VDBG) log("Setting MTU size: " + iface + ", " + mtu);
+ if (DBG) log("Setting MTU size: " + iface + ", " + mtu);
mNetd.setMtu(iface, mtu);
} catch (Exception e) {
Slog.e(TAG, "exception in setMtu()" + e);
@@ -1579,7 +1579,7 @@
}
if (values == null || values.length != 6) {
- if (VDBG) log("Invalid tcpBufferSizes string: " + tcpBufferSizes +", using defaults");
+ if (DBG) log("Invalid tcpBufferSizes string: " + tcpBufferSizes +", using defaults");
tcpBufferSizes = DEFAULT_TCP_BUFFER_SIZES;
values = tcpBufferSizes.split(",");
}
@@ -1587,7 +1587,7 @@
if (tcpBufferSizes.equals(mCurrentTcpBufferSizes)) return;
try {
- if (VDBG) Slog.d(TAG, "Setting tx/rx TCP buffers to " + tcpBufferSizes);
+ if (DBG) Slog.d(TAG, "Setting tx/rx TCP buffers to " + tcpBufferSizes);
final String prefix = "/sys/kernel/ipv4/tcp_";
FileUtils.stringToFile(prefix + "rmem_min", values[0]);
@@ -1750,7 +1750,7 @@
}
if (officialNai != null && officialNai.equals(nai)) return true;
if (officialNai != null || VDBG) {
- loge(msg + " - validateNetworkAgent found mismatched netId: " + officialNai +
+ loge(msg + " - isLiveNetworkAgent found mismatched netId: " + officialNai +
" - " + nai);
}
return false;
@@ -1794,7 +1794,7 @@
loge("NetworkAgent not found for EVENT_NETWORK_PROPERTIES_CHANGED");
} else {
if (VDBG) {
- log("Update of Linkproperties for " + nai.name() +
+ log("Update of LinkProperties for " + nai.name() +
"; created=" + nai.created);
}
LinkProperties oldLp = nai.linkProperties;
@@ -2073,11 +2073,10 @@
for (int i = 0; i < nai.networkRequests.size(); i++) {
NetworkRequest request = nai.networkRequests.valueAt(i);
NetworkAgentInfo currentNetwork = mNetworkForRequestId.get(request.requestId);
- if (VDBG) {
- log(" checking request " + request + ", currentNetwork = " +
- (currentNetwork != null ? currentNetwork.name() : "null"));
- }
if (currentNetwork != null && currentNetwork.network.netId == nai.network.netId) {
+ if (DBG) {
+ log("Checking for replacement network to handle request " + request );
+ }
mNetworkForRequestId.remove(request.requestId);
sendUpdatedScoreToFactories(request, 0);
NetworkAgentInfo alternative = null;
@@ -2091,8 +2090,11 @@
alternative = existing;
}
}
- if (alternative != null && !toActivate.contains(alternative)) {
- toActivate.add(alternative);
+ if (alternative != null) {
+ if (DBG) log(" found replacement in " + alternative.name());
+ if (!toActivate.contains(alternative)) {
+ toActivate.add(alternative);
+ }
}
}
}
@@ -2115,9 +2117,9 @@
// Check for the best currently alive network that satisfies this request
NetworkAgentInfo bestNetwork = null;
for (NetworkAgentInfo network : mNetworkAgentInfos.values()) {
- if (VDBG) log("handleRegisterNetworkRequest checking " + network.name());
+ if (DBG) log("handleRegisterNetworkRequest checking " + network.name());
if (newCap.satisfiedByNetworkCapabilities(network.networkCapabilities)) {
- if (VDBG) log("apparently satisfied. currentScore=" + network.currentScore);
+ if (DBG) log("apparently satisfied. currentScore=" + network.currentScore);
if ((bestNetwork == null) || bestNetwork.currentScore < network.currentScore) {
if (!nri.isRequest) {
// Not setting bestNetwork here as a listening NetworkRequest may be
@@ -2132,7 +2134,7 @@
}
}
if (bestNetwork != null) {
- if (VDBG) log("using " + bestNetwork.name());
+ if (DBG) log("using " + bestNetwork.name());
if (bestNetwork.networkInfo.isConnected()) {
// Cancel any lingering so the linger timeout doesn't teardown this network
// even though we have a request for it.
@@ -2173,7 +2175,7 @@
for (NetworkAgentInfo nai : mNetworkAgentInfos.values()) {
if (nai.networkRequests.get(nri.request.requestId) != null) {
nai.networkRequests.remove(nri.request.requestId);
- if (VDBG) {
+ if (DBG) {
log(" Removing from current network " + nai.name() +
", leaving " + nai.networkRequests.size() +
" requests.");
@@ -3920,7 +3922,7 @@
private void handleNetworkSamplingTimeout() {
- log("Sampling interval elapsed, updating statistics ..");
+ if (SAMPLE_DBG) log("Sampling interval elapsed, updating statistics ..");
// initialize list of interfaces ..
Map<String, SamplingDataTracker.SamplingSnapshot> mapIfaceToSample =
@@ -3951,13 +3953,15 @@
}
}
- log("Done.");
+ if (SAMPLE_DBG) log("Done.");
int samplingIntervalInSeconds = Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.CONNECTIVITY_SAMPLING_INTERVAL_IN_SECONDS,
DEFAULT_SAMPLING_INTERVAL_IN_SECONDS);
- if (DBG) log("Setting timer for " + String.valueOf(samplingIntervalInSeconds) + "seconds");
+ if (SAMPLE_DBG) {
+ log("Setting timer for " + String.valueOf(samplingIntervalInSeconds) + "seconds");
+ }
setAlarm(samplingIntervalInSeconds * 1000, mSampleIntervalElapsedIntent);
}
@@ -4125,7 +4129,7 @@
}
private void handleRegisterNetworkFactory(NetworkFactoryInfo nfi) {
- if (VDBG) log("Got NetworkFactory Messenger for " + nfi.name);
+ if (DBG) log("Got NetworkFactory Messenger for " + nfi.name);
mNetworkFactoryInfos.put(nfi.messenger, nfi);
nfi.asyncChannel.connect(mContext, mTrackerHandler, nfi.messenger);
}
@@ -4139,10 +4143,10 @@
private void handleUnregisterNetworkFactory(Messenger messenger) {
NetworkFactoryInfo nfi = mNetworkFactoryInfos.remove(messenger);
if (nfi == null) {
- if (VDBG) log("Failed to find Messenger in unregisterNetworkFactory");
+ loge("Failed to find Messenger in unregisterNetworkFactory");
return;
}
- if (VDBG) log("unregisterNetworkFactory for " + nfi.name);
+ if (DBG) log("unregisterNetworkFactory for " + nfi.name);
}
/**
@@ -4180,7 +4184,7 @@
synchronized (this) {
nai.networkMonitor.systemReady = mSystemReady;
}
- if (VDBG) log("registerNetworkAgent " + nai);
+ if (DBG) log("registerNetworkAgent " + nai);
mHandler.sendMessage(mHandler.obtainMessage(EVENT_REGISTER_NETWORK_AGENT, nai));
}
@@ -4241,6 +4245,7 @@
}
for (String iface : interfaceDiff.added) {
try {
+ if (DBG) log("Adding iface " + iface + " to network " + netId);
mNetd.addInterfaceToNetwork(iface, netId);
} catch (Exception e) {
loge("Exception adding interface: " + e);
@@ -4248,6 +4253,7 @@
}
for (String iface : interfaceDiff.removed) {
try {
+ if (DBG) log("Removing iface " + iface + " from network " + netId);
mNetd.removeInterfaceFromNetwork(iface, netId);
} catch (Exception e) {
loge("Exception removing interface: " + e);
@@ -4272,22 +4278,29 @@
// do this twice, adding non-nexthop routes first, then routes they are dependent on
for (RouteInfo route : routeDiff.added) {
if (route.hasGateway()) continue;
+ if (DBG) log("Adding Route [" + route + "] to network " + netId);
try {
mNetd.addRoute(netId, route);
} catch (Exception e) {
- loge("Exception in addRoute for non-gateway: " + e);
+ if ((route.getDestination().getAddress() instanceof Inet4Address) || VDBG) {
+ loge("Exception in addRoute for non-gateway: " + e);
+ }
}
}
for (RouteInfo route : routeDiff.added) {
if (route.hasGateway() == false) continue;
+ if (DBG) log("Adding Route [" + route + "] to network " + netId);
try {
mNetd.addRoute(netId, route);
} catch (Exception e) {
- loge("Exception in addRoute for gateway: " + e);
+ if ((route.getGateway() instanceof Inet4Address) || VDBG) {
+ loge("Exception in addRoute for gateway: " + e);
+ }
}
}
for (RouteInfo route : routeDiff.removed) {
+ if (DBG) log("Removing Route [" + route + "] from network " + netId);
try {
mNetd.removeRoute(netId, route);
} catch (Exception e) {
@@ -4306,6 +4319,7 @@
loge("no dns provided for netId " + netId + ", so using defaults");
}
}
+ if (DBG) log("Setting Dns servers for network " + netId + " to " + dnses);
try {
mNetd.setDnsServersForNetwork(netId, NetworkUtils.makeStrings(dnses),
newLp.getDomains());
@@ -4395,7 +4409,10 @@
msg.obj = o;
msg.what = notificationType;
try {
- if (VDBG) log("sending notification " + notificationType + " for " + nri.request);
+ if (VDBG) {
+ log("sending notification " + notifyTypeToName(notificationType) +
+ " for " + nri.request);
+ }
nri.messenger.send(msg);
} catch (RemoteException e) {
// may occur naturally in the race of binder death.
@@ -4418,7 +4435,7 @@
}
private void makeDefault(NetworkAgentInfo newNetwork) {
- if (VDBG) log("Switching to new default network: " + newNetwork);
+ if (DBG) log("Switching to new default network: " + newNetwork);
mActiveDefaultNetwork = newNetwork.networkInfo.getType();
setupDataActivityTracking(newNetwork);
try {
@@ -4444,7 +4461,7 @@
for (NetworkRequestInfo nri : mNetworkRequests.values()) {
NetworkAgentInfo currentNetwork = mNetworkForRequestId.get(nri.request.requestId);
if (newNetwork == currentNetwork) {
- if (VDBG) log("Network " + newNetwork.name() + " was already satisfying" +
+ if (DBG) log("Network " + newNetwork.name() + " was already satisfying" +
" request " + nri.request.requestId + ". No change.");
keep = true;
continue;
@@ -4468,12 +4485,12 @@
if (currentNetwork == null ||
currentNetwork.currentScore < newNetwork.currentScore) {
if (currentNetwork != null) {
- if (VDBG) log(" accepting network in place of " + currentNetwork.name());
+ if (DBG) log(" accepting network in place of " + currentNetwork.name());
currentNetwork.networkRequests.remove(nri.request.requestId);
currentNetwork.networkLingered.add(nri.request);
affectedNetworks.add(currentNetwork);
} else {
- if (VDBG) log(" accepting network in place of null");
+ if (DBG) log(" accepting network in place of null");
}
mNetworkForRequestId.put(nri.request.requestId, newNetwork);
newNetwork.addRequest(nri.request);
@@ -4574,7 +4591,7 @@
loge(" " + newNetwork.networkRequests.valueAt(i));
}
}
- if (VDBG) log("Validated network turns out to be unwanted. Tear it down.");
+ if (DBG) log("Validated network turns out to be unwanted. Tear it down.");
newNetwork.asyncChannel.disconnect();
}
}
@@ -4745,7 +4762,7 @@
}
protected void notifyNetworkCallbacks(NetworkAgentInfo networkAgent, int notifyType) {
- if (VDBG) log("notifyType " + notifyType + " for " + networkAgent.name());
+ if (DBG) log("notifyType " + notifyTypeToName(notifyType) + " for " + networkAgent.name());
for (int i = 0; i < networkAgent.networkRequests.size(); i++) {
NetworkRequest nr = networkAgent.networkRequests.valueAt(i);
NetworkRequestInfo nri = mNetworkRequests.get(nr);
@@ -4754,6 +4771,20 @@
}
}
+ private String notifyTypeToName(int notifyType) {
+ switch (notifyType) {
+ case ConnectivityManager.CALLBACK_PRECHECK: return "PRECHECK";
+ case ConnectivityManager.CALLBACK_AVAILABLE: return "AVAILABLE";
+ case ConnectivityManager.CALLBACK_LOSING: return "LOSING";
+ case ConnectivityManager.CALLBACK_LOST: return "LOST";
+ case ConnectivityManager.CALLBACK_UNAVAIL: return "UNAVAILABLE";
+ case ConnectivityManager.CALLBACK_CAP_CHANGED: return "CAP_CHANGED";
+ case ConnectivityManager.CALLBACK_IP_CHANGED: return "IP_CHANGED";
+ case ConnectivityManager.CALLBACK_RELEASED: return "RELEASED";
+ }
+ return "UNKNOWN";
+ }
+
private LinkProperties getLinkPropertiesForTypeInternal(int networkType) {
NetworkAgentInfo nai = mLegacyTypeTracker.getNetworkForType(networkType);
if (nai != null) {
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index ffadcf2..28cc99f 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -3740,6 +3740,7 @@
if (!mHasFeature) {
return;
}
+ final int userHandle = UserHandle.getCallingUserId();
synchronized (this) {
// Check for permissions
if (who == null) {
@@ -3753,7 +3754,7 @@
try {
mUserManager.setUserEnabled(userId);
Intent intent = new Intent(Intent.ACTION_MANAGED_PROFILE_ADDED);
- intent.putExtra(Intent.EXTRA_USER, new UserHandle(UserHandle.getCallingUserId()));
+ intent.putExtra(Intent.EXTRA_USER, new UserHandle(userHandle));
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY |
Intent.FLAG_RECEIVER_FOREGROUND);
// TODO This should send to parent of profile (which is always owner at the moment).
@@ -3940,6 +3941,8 @@
@Override
public void addPersistentPreferredActivity(ComponentName who, IntentFilter filter,
ComponentName activity) {
+ final int userHandle = UserHandle.getCallingUserId();
+
synchronized (this) {
if (who == null) {
throw new NullPointerException("ComponentName is null");
@@ -3949,7 +3952,7 @@
IPackageManager pm = AppGlobals.getPackageManager();
long id = Binder.clearCallingIdentity();
try {
- pm.addPersistentPreferredActivity(filter, activity, UserHandle.getCallingUserId());
+ pm.addPersistentPreferredActivity(filter, activity, userHandle);
} catch (RemoteException re) {
// Shouldn't happen
} finally {
@@ -3960,6 +3963,8 @@
@Override
public void clearPackagePersistentPreferredActivities(ComponentName who, String packageName) {
+ final int userHandle = UserHandle.getCallingUserId();
+
synchronized (this) {
if (who == null) {
throw new NullPointerException("ComponentName is null");
@@ -3969,7 +3974,7 @@
IPackageManager pm = AppGlobals.getPackageManager();
long id = Binder.clearCallingIdentity();
try {
- pm.clearPackagePersistentPreferredActivities(packageName, UserHandle.getCallingUserId());
+ pm.clearPackagePersistentPreferredActivities(packageName, userHandle);
} catch (RemoteException re) {
// Shouldn't happen
} finally {
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 0f2aabc..f339dba 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -918,7 +918,7 @@
mSystemServiceManager.startService(HdmiControlService.class);
}
- if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK)) {
+ if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_LIVE_TV)) {
mSystemServiceManager.startService(TvInputManagerService.class);
}