Merge "Add stroke support to polygonal shape rendering" into jb-mr1-dev
diff --git a/api/current.txt b/api/current.txt
index a123620..91e5ddd 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -10665,7 +10665,7 @@
method public float getAccuracy();
method public double getAltitude();
method public float getBearing();
- method public long getElapsedRealtimeNano();
+ method public long getElapsedRealtimeNanos();
method public android.os.Bundle getExtras();
method public double getLatitude();
method public double getLongitude();
@@ -10685,7 +10685,7 @@
method public void setAccuracy(float);
method public void setAltitude(double);
method public void setBearing(float);
- method public void setElapsedRealtimeNano(long);
+ method public void setElapsedRealtimeNanos(long);
method public void setExtras(android.os.Bundle);
method public void setLatitude(double);
method public void setLongitude(double);
@@ -12745,14 +12745,12 @@
method public static javax.net.ssl.SSLSocketFactory getDefault(int, android.net.SSLSessionCache);
method public java.lang.String[] getDefaultCipherSuites();
method public static org.apache.http.conn.ssl.SSLSocketFactory getHttpSocketFactory(int, android.net.SSLSessionCache);
- method public static org.apache.http.conn.ssl.SSLSocketFactory getHttpSocketFactory(int, int, android.net.SSLSessionCache);
method public static javax.net.ssl.SSLSocketFactory getInsecure(int, android.net.SSLSessionCache);
method public byte[] getNpnSelectedProtocol(java.net.Socket);
method public java.lang.String[] getSupportedCipherSuites();
method public void setHostname(java.net.Socket, java.lang.String);
method public void setKeyManagers(javax.net.ssl.KeyManager[]);
method public void setNpnProtocols(byte[][]);
- method public void setSoWriteTimeout(java.net.Socket, int) throws java.net.SocketException;
method public void setTrustManagers(javax.net.ssl.TrustManager[]);
method public void setUseSessionTickets(java.net.Socket, boolean);
}
@@ -16576,7 +16574,7 @@
public final class SystemClock {
method public static long currentThreadTimeMillis();
method public static long elapsedRealtime();
- method public static long elapsedRealtimeNano();
+ method public static long elapsedRealtimeNanos();
method public static boolean setCurrentTimeMillis(long);
method public static void sleep(long);
method public static long uptimeMillis();
@@ -18919,7 +18917,7 @@
field public static final deprecated java.lang.String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS = "wifi_watchdog_background_check_timeout_ms";
field public static final deprecated java.lang.String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT = "wifi_watchdog_initial_ignored_ping_count";
field public static final deprecated java.lang.String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks";
- field public static final java.lang.String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
+ field public static final deprecated java.lang.String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
field public static final deprecated java.lang.String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count";
field public static final deprecated java.lang.String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms";
field public static final deprecated java.lang.String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms";
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java
index bc9e74e..396b32f 100644
--- a/cmds/am/src/com/android/commands/am/Am.java
+++ b/cmds/am/src/com/android/commands/am/Am.java
@@ -804,8 +804,9 @@
ParcelFileDescriptor fd = null;
try {
- fd = ParcelFileDescriptor.open(
- new File(heapFile),
+ File file = new File(heapFile);
+ file.delete();
+ fd = ParcelFileDescriptor.open(file,
ParcelFileDescriptor.MODE_CREATE |
ParcelFileDescriptor.MODE_TRUNCATE |
ParcelFileDescriptor.MODE_READ_WRITE);
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index 9b08493..9874b0b 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -1509,9 +1509,9 @@
case DUMP_HEAP_TRANSACTION: {
data.enforceInterface(IActivityManager.descriptor);
String process = data.readString();
+ int userId = data.readInt();
boolean managed = data.readInt() != 0;
String path = data.readString();
- int userId = data.readInt();
ParcelFileDescriptor fd = data.readInt() != 0
? data.readFileDescriptor() : null;
boolean res = dumpHeap(process, userId, managed, path, fd);
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index d4b204f..6638433 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -2711,7 +2711,7 @@
r.activity.performResume();
EventLog.writeEvent(LOG_ON_RESUME_CALLED,
- r.activity.getComponentName().getClassName());
+ UserHandle.myUserId(), r.activity.getComponentName().getClassName());
r.paused = false;
r.stopped = false;
@@ -2979,7 +2979,8 @@
// Now we are idle.
r.activity.mCalled = false;
mInstrumentation.callActivityOnPause(r.activity);
- EventLog.writeEvent(LOG_ON_PAUSE_CALLED, r.activity.getComponentName().getClassName());
+ EventLog.writeEvent(LOG_ON_PAUSE_CALLED, UserHandle.myUserId(),
+ r.activity.getComponentName().getClassName());
if (!r.activity.mCalled) {
throw new SuperNotCalledException(
"Activity " + r.intent.getComponent().toShortString() +
@@ -3364,7 +3365,7 @@
try {
r.activity.mCalled = false;
mInstrumentation.callActivityOnPause(r.activity);
- EventLog.writeEvent(LOG_ON_PAUSE_CALLED,
+ EventLog.writeEvent(LOG_ON_PAUSE_CALLED, UserHandle.myUserId(),
r.activity.getComponentName().getClassName());
if (!r.activity.mCalled) {
throw new SuperNotCalledException(
diff --git a/core/java/android/app/BackStackRecord.java b/core/java/android/app/BackStackRecord.java
index 96814b7..1b1d341 100644
--- a/core/java/android/app/BackStackRecord.java
+++ b/core/java/android/app/BackStackRecord.java
@@ -20,6 +20,7 @@
import android.os.Parcelable;
import android.text.TextUtils;
import android.util.Log;
+import android.util.LogWriter;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -94,11 +95,12 @@
public BackStackRecord instantiate(FragmentManagerImpl fm) {
BackStackRecord bse = new BackStackRecord(fm);
int pos = 0;
+ int num = 0;
while (pos < mOps.length) {
BackStackRecord.Op op = new BackStackRecord.Op();
op.cmd = mOps[pos++];
if (FragmentManagerImpl.DEBUG) Log.v(FragmentManagerImpl.TAG,
- "BSE " + bse + " set base fragment #" + mOps[pos]);
+ "Instantiate " + bse + " op #" + num + " base fragment #" + mOps[pos]);
int findex = mOps[pos++];
if (findex >= 0) {
Fragment f = fm.mActive.get(findex);
@@ -115,12 +117,13 @@
op.removed = new ArrayList<Fragment>(N);
for (int i=0; i<N; i++) {
if (FragmentManagerImpl.DEBUG) Log.v(FragmentManagerImpl.TAG,
- "BSE " + bse + " set remove fragment #" + mOps[pos]);
+ "Instantiate " + bse + " set remove fragment #" + mOps[pos]);
Fragment r = fm.mActive.get(mOps[pos++]);
op.removed.add(r);
}
}
bse.addOp(op);
+ num++;
}
bse.mTransition = mTransition;
bse.mTransitionStyle = mTransitionStyle;
@@ -168,7 +171,7 @@
*/
final class BackStackRecord extends FragmentTransaction implements
FragmentManager.BackStackEntry, Runnable {
- static final String TAG = "BackStackEntry";
+ static final String TAG = FragmentManagerImpl.TAG;
final FragmentManagerImpl mManager;
@@ -206,46 +209,69 @@
boolean mAllowAddToBackStack = true;
String mName;
boolean mCommitted;
- int mIndex;
+ int mIndex = -1;
int mBreadCrumbTitleRes;
CharSequence mBreadCrumbTitleText;
int mBreadCrumbShortTitleRes;
CharSequence mBreadCrumbShortTitleText;
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder(128);
+ sb.append("BackStackEntry{");
+ sb.append(Integer.toHexString(System.identityHashCode(this)));
+ if (mIndex >= 0) {
+ sb.append(" #");
+ sb.append(mIndex);
+ }
+ if (mName != null) {
+ sb.append(" ");
+ sb.append(mName);
+ }
+ sb.append("}");
+ return sb.toString();
+ }
+
public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
- writer.print(prefix); writer.print("mName="); writer.print(mName);
- writer.print(" mIndex="); writer.print(mIndex);
- writer.print(" mCommitted="); writer.println(mCommitted);
- if (mTransition != FragmentTransaction.TRANSIT_NONE) {
- writer.print(prefix); writer.print("mTransition=#");
- writer.print(Integer.toHexString(mTransition));
- writer.print(" mTransitionStyle=#");
- writer.println(Integer.toHexString(mTransitionStyle));
- }
- if (mEnterAnim != 0 || mExitAnim !=0) {
- writer.print(prefix); writer.print("mEnterAnim=#");
- writer.print(Integer.toHexString(mEnterAnim));
- writer.print(" mExitAnim=#");
- writer.println(Integer.toHexString(mExitAnim));
- }
- if (mPopEnterAnim != 0 || mPopExitAnim !=0) {
- writer.print(prefix); writer.print("mPopEnterAnim=#");
- writer.print(Integer.toHexString(mPopEnterAnim));
- writer.print(" mPopExitAnim=#");
- writer.println(Integer.toHexString(mPopExitAnim));
- }
- if (mBreadCrumbTitleRes != 0 || mBreadCrumbTitleText != null) {
- writer.print(prefix); writer.print("mBreadCrumbTitleRes=#");
- writer.print(Integer.toHexString(mBreadCrumbTitleRes));
- writer.print(" mBreadCrumbTitleText=");
- writer.println(mBreadCrumbTitleText);
- }
- if (mBreadCrumbShortTitleRes != 0 || mBreadCrumbShortTitleText != null) {
- writer.print(prefix); writer.print("mBreadCrumbShortTitleRes=#");
- writer.print(Integer.toHexString(mBreadCrumbShortTitleRes));
- writer.print(" mBreadCrumbShortTitleText=");
- writer.println(mBreadCrumbShortTitleText);
+ dump(prefix, writer, true);
+ }
+
+ void dump(String prefix, PrintWriter writer, boolean full) {
+ if (full) {
+ writer.print(prefix); writer.print("mName="); writer.print(mName);
+ writer.print(" mIndex="); writer.print(mIndex);
+ writer.print(" mCommitted="); writer.println(mCommitted);
+ if (mTransition != FragmentTransaction.TRANSIT_NONE) {
+ writer.print(prefix); writer.print("mTransition=#");
+ writer.print(Integer.toHexString(mTransition));
+ writer.print(" mTransitionStyle=#");
+ writer.println(Integer.toHexString(mTransitionStyle));
+ }
+ if (mEnterAnim != 0 || mExitAnim !=0) {
+ writer.print(prefix); writer.print("mEnterAnim=#");
+ writer.print(Integer.toHexString(mEnterAnim));
+ writer.print(" mExitAnim=#");
+ writer.println(Integer.toHexString(mExitAnim));
+ }
+ if (mPopEnterAnim != 0 || mPopExitAnim !=0) {
+ writer.print(prefix); writer.print("mPopEnterAnim=#");
+ writer.print(Integer.toHexString(mPopEnterAnim));
+ writer.print(" mPopExitAnim=#");
+ writer.println(Integer.toHexString(mPopExitAnim));
+ }
+ if (mBreadCrumbTitleRes != 0 || mBreadCrumbTitleText != null) {
+ writer.print(prefix); writer.print("mBreadCrumbTitleRes=#");
+ writer.print(Integer.toHexString(mBreadCrumbTitleRes));
+ writer.print(" mBreadCrumbTitleText=");
+ writer.println(mBreadCrumbTitleText);
+ }
+ if (mBreadCrumbShortTitleRes != 0 || mBreadCrumbShortTitleText != null) {
+ writer.print(prefix); writer.print("mBreadCrumbShortTitleRes=#");
+ writer.print(Integer.toHexString(mBreadCrumbShortTitleRes));
+ writer.print(" mBreadCrumbShortTitleText=");
+ writer.println(mBreadCrumbShortTitleText);
+ }
}
if (mHead != null) {
@@ -254,21 +280,34 @@
Op op = mHead;
int num = 0;
while (op != null) {
- writer.print(prefix); writer.print(" Op #"); writer.print(num);
- writer.println(":");
- writer.print(innerPrefix); writer.print("cmd="); writer.print(op.cmd);
- writer.print(" fragment="); writer.println(op.fragment);
- if (op.enterAnim != 0 || op.exitAnim != 0) {
- writer.print(prefix); writer.print("enterAnim=#");
- writer.print(Integer.toHexString(op.enterAnim));
- writer.print(" exitAnim=#");
- writer.println(Integer.toHexString(op.exitAnim));
+ String cmdStr;
+ switch (op.cmd) {
+ case OP_NULL: cmdStr="NULL"; break;
+ case OP_ADD: cmdStr="ADD"; break;
+ case OP_REPLACE: cmdStr="REPLACE"; break;
+ case OP_REMOVE: cmdStr="REMOVE"; break;
+ case OP_HIDE: cmdStr="HIDE"; break;
+ case OP_SHOW: cmdStr="SHOW"; break;
+ case OP_DETACH: cmdStr="DETACH"; break;
+ case OP_ATTACH: cmdStr="ATTACH"; break;
+ default: cmdStr="cmd=" + op.cmd; break;
}
- if (op.popEnterAnim != 0 || op.popExitAnim != 0) {
- writer.print(prefix); writer.print("popEnterAnim=#");
- writer.print(Integer.toHexString(op.popEnterAnim));
- writer.print(" popExitAnim=#");
- writer.println(Integer.toHexString(op.popExitAnim));
+ writer.print(prefix); writer.print(" Op #"); writer.print(num);
+ writer.print(": "); writer.print(cmdStr);
+ writer.print(" "); writer.println(op.fragment);
+ if (full) {
+ if (op.enterAnim != 0 || op.exitAnim != 0) {
+ writer.print(innerPrefix); writer.print("enterAnim=#");
+ writer.print(Integer.toHexString(op.enterAnim));
+ writer.print(" exitAnim=#");
+ writer.println(Integer.toHexString(op.exitAnim));
+ }
+ if (op.popEnterAnim != 0 || op.popExitAnim != 0) {
+ writer.print(innerPrefix); writer.print("popEnterAnim=#");
+ writer.print(Integer.toHexString(op.popEnterAnim));
+ writer.print(" popExitAnim=#");
+ writer.println(Integer.toHexString(op.popExitAnim));
+ }
}
if (op.removed != null && op.removed.size() > 0) {
for (int i=0; i<op.removed.size(); i++) {
@@ -276,14 +315,17 @@
if (op.removed.size() == 1) {
writer.print("Removed: ");
} else {
- writer.println("Removed:");
- writer.print(innerPrefix); writer.print(" #"); writer.print(num);
+ if (i == 0) {
+ writer.println("Removed:");
+ }
+ writer.print(innerPrefix); writer.print(" #"); writer.print(i);
writer.print(": ");
}
writer.println(op.removed.get(i));
}
}
op = op.next;
+ num++;
}
}
}
@@ -538,7 +580,12 @@
int commitInternal(boolean allowStateLoss) {
if (mCommitted) throw new IllegalStateException("commit already called");
- if (FragmentManagerImpl.DEBUG) Log.v(TAG, "Commit: " + this);
+ if (FragmentManagerImpl.DEBUG) {
+ Log.v(TAG, "Commit: " + this);
+ LogWriter logw = new LogWriter(Log.VERBOSE, TAG);
+ PrintWriter pw = new PrintWriter(logw);
+ dump(" ", null, pw, null);
+ }
mCommitted = true;
if (mAddToBackStack) {
mIndex = mManager.allocBackStackIndex(this);
@@ -641,7 +688,12 @@
}
public void popFromBackStack(boolean doStateMove) {
- if (FragmentManagerImpl.DEBUG) Log.v(TAG, "popFromBackStack: " + this);
+ if (FragmentManagerImpl.DEBUG) {
+ Log.v(TAG, "popFromBackStack: " + this);
+ LogWriter logw = new LogWriter(Log.VERBOSE, TAG);
+ PrintWriter pw = new PrintWriter(logw);
+ dump(" ", null, pw, null);
+ }
bumpBackStackNesting(-1);
diff --git a/core/java/android/app/FragmentManager.java b/core/java/android/app/FragmentManager.java
index aad5487..e983299 100644
--- a/core/java/android/app/FragmentManager.java
+++ b/core/java/android/app/FragmentManager.java
@@ -22,6 +22,7 @@
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.os.Bundle;
+import android.os.Debug;
import android.os.Handler;
import android.os.Looper;
import android.os.Parcel;
@@ -771,9 +772,9 @@
void moveToState(Fragment f, int newState, int transit, int transitionStyle,
boolean keepActive) {
- //if (DEBUG) Log.v(TAG, "moveToState: " + f
- // + " oldState=" + f.mState + " newState=" + newState
- // + " mRemoving=" + f.mRemoving + " Callers=" + Debug.getCallers(5));
+ if (DEBUG && false) Log.v(TAG, "moveToState: " + f
+ + " oldState=" + f.mState + " newState=" + newState
+ + " mRemoving=" + f.mRemoving + " Callers=" + Debug.getCallers(5));
// Fragments that are not currently added will sit in the onCreate() state.
if ((!f.mAdded || f.mDetached) && newState > Fragment.CREATED) {
@@ -1112,6 +1113,9 @@
if (DEBUG) Log.v(TAG, "add: " + fragment);
makeActive(fragment);
if (!fragment.mDetached) {
+ if (mAdded.contains(fragment)) {
+ throw new IllegalStateException("Fragment already added: " + fragment);
+ }
mAdded.add(fragment);
fragment.mAdded = true;
fragment.mRemoving = false;
@@ -1128,6 +1132,14 @@
if (DEBUG) Log.v(TAG, "remove: " + fragment + " nesting=" + fragment.mBackStackNesting);
final boolean inactive = !fragment.isInBackStack();
if (!fragment.mDetached || inactive) {
+ if (false) {
+ // Would be nice to catch a bad remove here, but we need
+ // time to test this to make sure we aren't crashes cases
+ // where it is not a problem.
+ if (!mAdded.contains(fragment)) {
+ throw new IllegalStateException("Fragment not added: " + fragment);
+ }
+ }
if (mAdded != null) {
mAdded.remove(fragment);
}
@@ -1200,6 +1212,7 @@
if (fragment.mAdded) {
// We are not already in back stack, so need to remove the fragment.
if (mAdded != null) {
+ if (DEBUG) Log.v(TAG, "remove from detach: " + fragment);
mAdded.remove(fragment);
}
if (fragment.mHasMenu && fragment.mMenuVisible) {
@@ -1219,6 +1232,10 @@
if (mAdded == null) {
mAdded = new ArrayList<Fragment>();
}
+ if (mAdded.contains(fragment)) {
+ throw new IllegalStateException("Fragment already added: " + fragment);
+ }
+ if (DEBUG) Log.v(TAG, "add from attach: " + fragment);
mAdded.add(fragment);
fragment.mAdded = true;
if (fragment.mHasMenu && fragment.mMenuVisible) {
@@ -1717,19 +1734,18 @@
FragmentState fs = fms.mActive[i];
if (fs != null) {
Fragment f = fs.instantiate(mActivity, mParent);
- if (DEBUG) Log.v(TAG, "restoreAllState: adding #" + i + ": " + f);
+ if (DEBUG) Log.v(TAG, "restoreAllState: active #" + i + ": " + f);
mActive.add(f);
// Now that the fragment is instantiated (or came from being
// retained above), clear mInstance in case we end up re-restoring
// from this FragmentState again.
fs.mInstance = null;
} else {
- if (DEBUG) Log.v(TAG, "restoreAllState: adding #" + i + ": (null)");
mActive.add(null);
if (mAvailIndices == null) {
mAvailIndices = new ArrayList<Integer>();
}
- if (DEBUG) Log.v(TAG, "restoreAllState: adding avail #" + i);
+ if (DEBUG) Log.v(TAG, "restoreAllState: avail #" + i);
mAvailIndices.add(i);
}
}
@@ -1760,7 +1776,10 @@
"No instantiated fragment for index #" + fms.mAdded[i]));
}
f.mAdded = true;
- if (DEBUG) Log.v(TAG, "restoreAllState: making added #" + i + ": " + f);
+ if (DEBUG) Log.v(TAG, "restoreAllState: added #" + i + ": " + f);
+ if (mAdded.contains(f)) {
+ throw new IllegalStateException("Already added!");
+ }
mAdded.add(f);
}
} else {
@@ -1772,8 +1791,13 @@
mBackStack = new ArrayList<BackStackRecord>(fms.mBackStack.length);
for (int i=0; i<fms.mBackStack.length; i++) {
BackStackRecord bse = fms.mBackStack[i].instantiate(this);
- if (DEBUG) Log.v(TAG, "restoreAllState: adding bse #" + i
+ if (DEBUG) {
+ Log.v(TAG, "restoreAllState: back stack #" + i
+ " (index " + bse.mIndex + "): " + bse);
+ LogWriter logw = new LogWriter(Log.VERBOSE, TAG);
+ PrintWriter pw = new PrintWriter(logw);
+ bse.dump(" ", pw, false);
+ }
mBackStack.add(bse);
if (bse.mIndex >= 0) {
setBackStackIndex(bse.mIndex, bse);
diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java
index c095280..0acad75 100644
--- a/core/java/android/app/NotificationManager.java
+++ b/core/java/android/app/NotificationManager.java
@@ -124,6 +124,9 @@
int[] idOut = new int[1];
INotificationManager service = getService();
String pkg = mContext.getPackageName();
+ if (notification.sound != null) {
+ notification.sound = notification.sound.getCanonicalUri();
+ }
if (localLOGV) Log.v(TAG, pkg + ": notify(" + id + ", " + notification + ")");
try {
service.enqueueNotificationWithTag(pkg, tag, id, notification, idOut,
@@ -143,6 +146,9 @@
int[] idOut = new int[1];
INotificationManager service = getService();
String pkg = mContext.getPackageName();
+ if (notification.sound != null) {
+ notification.sound = notification.sound.getCanonicalUri();
+ }
if (localLOGV) Log.v(TAG, pkg + ": notify(" + id + ", " + notification + ")");
try {
service.enqueueNotificationWithTag(pkg, tag, id, notification, idOut,
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index ac36cf7..201b43f 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -178,7 +178,7 @@
* Flag for {@link #bindService}: indicates that the client application
* binding to this service considers the service to be more important than
* the app itself. When set, the platform will try to have the out of
- * memory kill the app before it kills the service it is bound to, though
+ * memory killer kill the app before it kills the service it is bound to, though
* this is not guaranteed to be the case.
*/
public static final int BIND_ABOVE_CLIENT = 0x0008;
@@ -219,6 +219,19 @@
public static final int BIND_ADJUST_WITH_ACTIVITY = 0x0080;
/**
+ * @hide An idea that is not yet implemented.
+ * Flag for {@link #bindService}: If binding from an activity, consider
+ * this service to be visible like the binding activity is. That is,
+ * it will be treated as something more important to keep around than
+ * invisible background activities. This will impact the number of
+ * recent activities the user can switch between without having them
+ * restart. There is no guarantee this will be respected, as the system
+ * tries to balance such requests from one app vs. the importantance of
+ * keeping other apps around.
+ */
+ public static final int BIND_VISIBLE = 0x0100;
+
+ /**
* Flag for {@link #bindService}: Don't consider the bound service to be
* visible, even if the caller is visible.
* @hide
diff --git a/core/java/android/content/SyncManager.java b/core/java/android/content/SyncManager.java
index 4257e0e..4999a2d 100644
--- a/core/java/android/content/SyncManager.java
+++ b/core/java/android/content/SyncManager.java
@@ -203,6 +203,12 @@
}
};
+ private BroadcastReceiver mAccountsUpdatedReceiver = new BroadcastReceiver() {
+ public void onReceive(Context context, Intent intent) {
+ onAccountsUpdated(null);
+ }
+ };
+
private final PowerManager mPowerManager;
// Use this as a random offset to seed all periodic syncs
@@ -456,8 +462,11 @@
});
if (!factoryTest) {
- AccountManager.get(mContext).addOnAccountsUpdatedListener(SyncManager.this,
- mSyncHandler, false /* updateImmediately */);
+ // Register for account list updates for all users
+ mContext.registerReceiverAsUser(mAccountsUpdatedReceiver,
+ UserHandle.ALL,
+ new IntentFilter(AccountManager.LOGIN_ACCOUNTS_CHANGED_ACTION),
+ null, null);
// do this synchronously to ensure we have the accounts before this call returns
onAccountsUpdated(null);
}
diff --git a/core/java/android/hardware/display/DisplayManager.java b/core/java/android/hardware/display/DisplayManager.java
index 58a0f13c..28e320b 100644
--- a/core/java/android/hardware/display/DisplayManager.java
+++ b/core/java/android/hardware/display/DisplayManager.java
@@ -46,9 +46,7 @@
* The status is provided as a {@link WifiDisplayStatus} object in the
* {@link #EXTRA_WIFI_DISPLAY_STATUS} extra.
* </p><p>
- * This broadcast is only sent to registered receivers with the
- * {@link android.Manifest.permission#CONFIGURE_WIFI_DISPLAY} permission and can
- * only be sent by the system.
+ * This broadcast is only sent to registered receivers and can only be sent by the system.
* </p>
* @hide
*/
@@ -163,6 +161,9 @@
* <p>
* Automatically remembers the display after a successful connection, if not
* already remembered.
+ * </p><p>
+ * Requires {@link android.Manifest.permission#CONFIGURE_WIFI_DISPLAY} to connect
+ * to unknown displays. No permissions are required to connect to already known displays.
* </p>
*
* @param deviceAddress The MAC address of the device to which we should connect.
@@ -187,6 +188,8 @@
* The display must already be remembered for this call to succeed. In other words,
* we must already have successfully connected to the display at least once and then
* not forgotten it.
+ * </p><p>
+ * Requires {@link android.Manifest.permission#CONFIGURE_WIFI_DISPLAY}.
* </p>
*
* @param deviceAddress The MAC address of the device to rename.
@@ -202,6 +205,8 @@
* Forgets a previously remembered Wifi display.
* <p>
* Automatically disconnects from the display if currently connected to it.
+ * </p><p>
+ * Requires {@link android.Manifest.permission#CONFIGURE_WIFI_DISPLAY}.
* </p>
*
* @param deviceAddress The MAC address of the device to forget.
diff --git a/core/java/android/hardware/display/IDisplayManager.aidl b/core/java/android/hardware/display/IDisplayManager.aidl
index 4b6fb53..79aad78 100644
--- a/core/java/android/hardware/display/IDisplayManager.aidl
+++ b/core/java/android/hardware/display/IDisplayManager.aidl
@@ -28,13 +28,14 @@
void registerCallback(in IDisplayManagerCallback callback);
- // Requires CONFIGURE_WIFI_DISPLAY permission.
+ // No permissions required.
void scanWifiDisplays();
- // Requires CONFIGURE_WIFI_DISPLAY permission.
+ // Requires CONFIGURE_WIFI_DISPLAY permission to connect to an unknown device.
+ // No permissions required to connect to a known device.
void connectWifiDisplay(String address);
- // Requires CONFIGURE_WIFI_DISPLAY permission.
+ // No permissions required.
void disconnectWifiDisplay();
// Requires CONFIGURE_WIFI_DISPLAY permission.
@@ -43,6 +44,6 @@
// Requires CONFIGURE_WIFI_DISPLAY permission.
void forgetWifiDisplay(String address);
- // Requires CONFIGURE_WIFI_DISPLAY permission.
+ // No permissions required.
WifiDisplayStatus getWifiDisplayStatus();
}
diff --git a/core/java/android/net/SSLCertificateSocketFactory.java b/core/java/android/net/SSLCertificateSocketFactory.java
index 42fb5c3..846443d 100644
--- a/core/java/android/net/SSLCertificateSocketFactory.java
+++ b/core/java/android/net/SSLCertificateSocketFactory.java
@@ -90,7 +90,6 @@
private byte[] mNpnProtocols = null;
private final int mHandshakeTimeoutMillis;
- private final int mWriteTimeoutMillis;
private final SSLClientSessionCache mSessionCache;
private final boolean mSecure;
@@ -101,21 +100,12 @@
}
private SSLCertificateSocketFactory(
- int handshakeTimeoutMillis,
- int writeTimeoutMillis,
- SSLSessionCache cache,
- boolean secure) {
+ int handshakeTimeoutMillis, SSLSessionCache cache, boolean secure) {
mHandshakeTimeoutMillis = handshakeTimeoutMillis;
- mWriteTimeoutMillis = writeTimeoutMillis;
mSessionCache = cache == null ? null : cache.mSessionCache;
mSecure = secure;
}
- private SSLCertificateSocketFactory(
- int handshakeTimeoutMillis, SSLSessionCache cache, boolean secure) {
- this(handshakeTimeoutMillis, 0, cache, secure);
- }
-
/**
* Returns a new socket factory instance with an optional handshake timeout.
*
@@ -172,24 +162,6 @@
}
/**
- * Returns a socket factory (also named SSLSocketFactory, but in a different
- * namespace) for use with the Apache HTTP stack.
- *
- * @param handshakeTimeoutMillis to use for SSL connection handshake, or 0
- * for none. The socket timeout is reset to 0 after the handshake.
- * @param writeTimeoutMillis the desired write timeout in milliseconds or 0 for none.
- * @param cache The {@link SSLSessionCache} to use, or null for no cache.
- * @return a new SocketFactory with the specified parameters
- */
- public static org.apache.http.conn.ssl.SSLSocketFactory getHttpSocketFactory(
- int handshakeTimeoutMillis,
- int writeTimeoutMillis,
- SSLSessionCache cache) {
- return new org.apache.http.conn.ssl.SSLSocketFactory(new SSLCertificateSocketFactory(
- handshakeTimeoutMillis, writeTimeoutMillis, cache, true));
- }
-
- /**
* Verify the hostname of the certificate used by the other end of a
* connected socket. You MUST call this if you did not supply a hostname
* to {@link #createSocket()}. It is harmless to call this method
@@ -376,8 +348,10 @@
* To take effect, this option must be set before the blocking method was called.
*
* @param socket a socket created by this factory.
- * @param writeTimeoutMilliseconds the desired write timeout in milliseconds.
+ * @param timeout the desired write timeout in milliseconds.
* @throws IllegalArgumentException if the socket was not created by this factory.
+ *
+ * @hide
*/
public void setSoWriteTimeout(Socket socket, int writeTimeoutMilliseconds)
throws SocketException {
@@ -404,7 +378,6 @@
OpenSSLSocketImpl s = (OpenSSLSocketImpl) getDelegate().createSocket(k, host, port, close);
s.setNpnProtocols(mNpnProtocols);
s.setHandshakeTimeout(mHandshakeTimeoutMillis);
- s.setSoWriteTimeout(mWriteTimeoutMillis);
if (mSecure) {
verifyHostname(s, host);
}
@@ -424,7 +397,6 @@
OpenSSLSocketImpl s = (OpenSSLSocketImpl) getDelegate().createSocket();
s.setNpnProtocols(mNpnProtocols);
s.setHandshakeTimeout(mHandshakeTimeoutMillis);
- s.setSoWriteTimeout(mWriteTimeoutMillis);
return s;
}
@@ -442,7 +414,6 @@
addr, port, localAddr, localPort);
s.setNpnProtocols(mNpnProtocols);
s.setHandshakeTimeout(mHandshakeTimeoutMillis);
- s.setSoWriteTimeout(mWriteTimeoutMillis);
return s;
}
@@ -458,7 +429,6 @@
OpenSSLSocketImpl s = (OpenSSLSocketImpl) getDelegate().createSocket(addr, port);
s.setNpnProtocols(mNpnProtocols);
s.setHandshakeTimeout(mHandshakeTimeoutMillis);
- s.setSoWriteTimeout(mWriteTimeoutMillis);
return s;
}
@@ -475,7 +445,6 @@
host, port, localAddr, localPort);
s.setNpnProtocols(mNpnProtocols);
s.setHandshakeTimeout(mHandshakeTimeoutMillis);
- s.setSoWriteTimeout(mWriteTimeoutMillis);
if (mSecure) {
verifyHostname(s, host);
}
@@ -493,7 +462,6 @@
OpenSSLSocketImpl s = (OpenSSLSocketImpl) getDelegate().createSocket(host, port);
s.setNpnProtocols(mNpnProtocols);
s.setHandshakeTimeout(mHandshakeTimeoutMillis);
- s.setSoWriteTimeout(mWriteTimeoutMillis);
if (mSecure) {
verifyHostname(s, host);
}
diff --git a/core/java/android/net/Uri.java b/core/java/android/net/Uri.java
index 3b990e3..cc6903d 100644
--- a/core/java/android/net/Uri.java
+++ b/core/java/android/net/Uri.java
@@ -16,10 +16,13 @@
package android.net;
+import android.os.Environment;
import android.os.Parcel;
import android.os.Parcelable;
+import android.os.Environment.UserEnvironment;
import android.util.Log;
import java.io.File;
+import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.Charsets;
@@ -2288,4 +2291,39 @@
builder = builder.appendEncodedPath(pathSegment);
return builder.build();
}
+
+ /**
+ * If this {@link Uri} is {@code file://}, then resolve and return its
+ * canonical path. Also fixes legacy emulated storage paths so they are
+ * usable across user boundaries. Should always be called from the app
+ * process before sending elsewhere.
+ *
+ * @hide
+ */
+ public Uri getCanonicalUri() {
+ if ("file".equals(getScheme())) {
+ final String canonicalPath;
+ try {
+ canonicalPath = new File(getPath()).getCanonicalPath();
+ } catch (IOException e) {
+ return this;
+ }
+
+ if (Environment.isExternalStorageEmulated()) {
+ final String legacyPath = Environment.getLegacyExternalStorageDirectory()
+ .toString();
+
+ // Splice in user-specific path when legacy path is found
+ if (canonicalPath.startsWith(legacyPath)) {
+ return Uri.fromFile(new File(
+ Environment.getExternalStorageDirectory().toString(),
+ canonicalPath.substring(legacyPath.length() + 1)));
+ }
+ }
+
+ return Uri.fromFile(new File(canonicalPath));
+ } else {
+ return this;
+ }
+ }
}
diff --git a/core/java/android/net/http/AndroidHttpClient.java b/core/java/android/net/http/AndroidHttpClient.java
index 8169a94..c534e58 100644
--- a/core/java/android/net/http/AndroidHttpClient.java
+++ b/core/java/android/net/http/AndroidHttpClient.java
@@ -16,16 +16,7 @@
package android.net.http;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.net.SSLCertificateSocketFactory;
-import android.net.SSLSessionCache;
-import android.os.Looper;
-import android.util.Base64;
-import android.util.Log;
-
import com.android.internal.http.HttpDateTime;
-
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpEntityEnclosingRequest;
@@ -34,18 +25,18 @@
import org.apache.http.HttpRequest;
import org.apache.http.HttpRequestInterceptor;
import org.apache.http.HttpResponse;
-import org.apache.http.client.ClientProtocolException;
+import org.apache.http.entity.AbstractHttpEntity;
+import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.client.HttpClient;
import org.apache.http.client.ResponseHandler;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.protocol.ClientContext;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.client.params.HttpClientParams;
-import org.apache.http.client.protocol.ClientContext;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
-import org.apache.http.entity.AbstractHttpEntity;
-import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.client.RequestWrapper;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
@@ -53,17 +44,25 @@
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.apache.http.params.HttpProtocolParams;
-import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.BasicHttpProcessor;
import org.apache.http.protocol.HttpContext;
+import org.apache.http.protocol.BasicHttpContext;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
-import java.net.URI;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
+import java.net.URI;
+
+import android.content.Context;
+import android.content.ContentResolver;
+import android.net.SSLCertificateSocketFactory;
+import android.net.SSLSessionCache;
+import android.os.Looper;
+import android.util.Base64;
+import android.util.Log;
/**
* Implementation of the Apache {@link DefaultHttpClient} that is configured with
@@ -135,7 +134,7 @@
PlainSocketFactory.getSocketFactory(), 80));
schemeRegistry.register(new Scheme("https",
SSLCertificateSocketFactory.getHttpSocketFactory(
- SOCKET_OPERATION_TIMEOUT, SOCKET_OPERATION_TIMEOUT, sessionCache), 443));
+ SOCKET_OPERATION_TIMEOUT, sessionCache), 443));
ClientConnectionManager manager =
new ThreadSafeClientConnManager(params, schemeRegistry);
diff --git a/core/java/android/os/IPowerManager.aidl b/core/java/android/os/IPowerManager.aidl
index 7aee644..eec19cb 100644
--- a/core/java/android/os/IPowerManager.aidl
+++ b/core/java/android/os/IPowerManager.aidl
@@ -34,6 +34,7 @@
void userActivity(long time, int event, int flags);
void wakeUp(long time);
void goToSleep(long time, int reason);
+ void nap(long time);
boolean isScreenOn();
void reboot(String reason);
diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java
index cc2c002..58372f4 100644
--- a/core/java/android/os/PowerManager.java
+++ b/core/java/android/os/PowerManager.java
@@ -426,7 +426,7 @@
* </p>
*
* @param when The time of the user activity, in the {@link SystemClock#uptimeMillis()}
- * time base. This timestamp is used to correctly order the user activity with
+ * time base. This timestamp is used to correctly order the user activity request with
* other power management functions. It should be set
* to the timestamp of the input event that caused the user activity.
* @param noChangeLights If true, does not cause the keyboard backlight to turn on
@@ -457,7 +457,7 @@
*
* @param time The time when the request to go to sleep was issued, in the
* {@link SystemClock#uptimeMillis()} time base. This timestamp is used to correctly
- * order the user activity with other power management functions. It should be set
+ * order the go to sleep request with other power management functions. It should be set
* to the timestamp of the input event that caused the request to go to sleep.
*
* @see #userActivity
@@ -481,7 +481,7 @@
*
* @param time The time when the request to wake up was issued, in the
* {@link SystemClock#uptimeMillis()} time base. This timestamp is used to correctly
- * order the user activity with other power management functions. It should be set
+ * order the wake up request with other power management functions. It should be set
* to the timestamp of the input event that caused the request to wake up.
*
* @see #userActivity
@@ -495,6 +495,34 @@
}
/**
+ * Forces the device to start napping.
+ * <p>
+ * If the device is currently awake, starts dreaming, otherwise does nothing.
+ * When the dream ends or if the dream cannot be started, the device will
+ * either wake up or go to sleep depending on whether there has been recent
+ * user activity.
+ * </p><p>
+ * Requires the {@link android.Manifest.permission#DEVICE_POWER} permission.
+ * </p>
+ *
+ * @param time The time when the request to nap was issued, in the
+ * {@link SystemClock#uptimeMillis()} time base. This timestamp is used to correctly
+ * order the nap request with other power management functions. It should be set
+ * to the timestamp of the input event that caused the request to nap.
+ *
+ * @see #wakeUp
+ * @see #goToSleep
+ *
+ * @hide
+ */
+ public void nap(long time) {
+ try {
+ mService.nap(time);
+ } catch (RemoteException e) {
+ }
+ }
+
+ /**
* Sets the brightness of the backlights (screen, keyboard, button).
* <p>
* Requires the {@link android.Manifest.permission#DEVICE_POWER} permission.
diff --git a/core/java/android/os/SystemClock.java b/core/java/android/os/SystemClock.java
index a54c25b..c9adf45 100644
--- a/core/java/android/os/SystemClock.java
+++ b/core/java/android/os/SystemClock.java
@@ -50,7 +50,7 @@
* interval does not span device sleep. Most methods that accept a
* timestamp value currently expect the {@link #uptimeMillis} clock.
*
- * <li> <p> {@link #elapsedRealtime} and {@link #elapsedRealtimeNano}
+ * <li> <p> {@link #elapsedRealtime} and {@link #elapsedRealtimeNanos}
* return the time since the system was booted, and include deep sleep.
* This clock is guaranteed to be monotonic, and continues to tick even
* when the CPU is in power saving modes, so is the recommend basis
@@ -157,7 +157,7 @@
*
* @return elapsed nanoseconds since boot.
*/
- public static native long elapsedRealtimeNano();
+ public static native long elapsedRealtimeNanos();
/**
* Returns milliseconds running in the current thread.
diff --git a/core/java/android/os/UserHandle.aidl b/core/java/android/os/UserHandle.aidl
new file mode 100644
index 0000000..4892d32
--- /dev/null
+++ b/core/java/android/os/UserHandle.aidl
@@ -0,0 +1,19 @@
+/**
+ * Copyright (c) 2012, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.os;
+
+parcelable UserHandle;
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 965e488..0d980c0 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -3054,6 +3054,7 @@
/**
* @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead
*/
+ @Deprecated
public static final String DATA_ROAMING = Global.DATA_ROAMING;
/**
@@ -3215,27 +3216,6 @@
"lock_screen_owner_info_enabled";
/**
- * @deprecated Use {@link android.provider.Settings.Global#DISPLAY_SIZE_FORCED} instead
- * @hide
- */
- @Deprecated
- public static final String DISPLAY_SIZE_FORCED = Global.DISPLAY_SIZE_FORCED;
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#DISPLAY_DENSITY_FORCED} instead
- * @hide
- */
- @Deprecated
- public static final String DISPLAY_DENSITY_FORCED = Global.DISPLAY_DENSITY_FORCED;
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#ASSISTED_GPS_ENABLED} instead
- * @hide
- */
- @Deprecated
- public static final String ASSISTED_GPS_ENABLED = Global.ASSISTED_GPS_ENABLED;
-
- /**
* The Logging ID (a unique 64-bit value) as a hex string.
* Used as a pseudonymous identifier for logging.
* @deprecated This identifier is poorly initialized and has
@@ -3251,44 +3231,6 @@
public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE;
/**
- * @deprecated Use {@link android.provider.Settings.Global#TETHER_SUPPORTED} instead
- * @hide
- */
- @Deprecated
- public static final String TETHER_SUPPORTED = Global.TETHER_SUPPORTED;
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#TETHER_DUN_REQUIRED} instead
- * @hide
- */
- @Deprecated
- public static final String TETHER_DUN_REQUIRED = Global.TETHER_DUN_REQUIRED;
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#TETHER_DUN_REQUIRED} instead
- * @hide
- */
- @Deprecated
- public static final String TETHER_DUN_APN = Global.TETHER_DUN_APN;
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#DATA_ACTIVITY_TIMEOUT_MOBILE}
- * instead
- * @hide
- */
- @Deprecated
- public static final String DATA_ACTIVITY_TIMEOUT_MOBILE =
- Global.DATA_ACTIVITY_TIMEOUT_MOBILE;
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#DATA_ACTIVITY_TIMEOUT_MOBILE}
- * instead
- * @hide
- */
- @Deprecated
- public static final String DATA_ACTIVITY_TIMEOUT_WIFI = Global.DATA_ACTIVITY_TIMEOUT_WIFI;
-
- /**
* No longer supported.
*/
public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled";
@@ -3304,13 +3246,6 @@
public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url";
/**
- * @deprecated Use {@link android.provider.Settings.Global#SAMPLING_PROFILER_MS} instead
- * @hide
- */
- @Deprecated
- public static final String SAMPLING_PROFILER_MS = Global.SAMPLING_PROFILER_MS;
-
- /**
* Settings classname to launch when Settings is clicked from All
* Applications. Needed because of user testing between the old
* and new Settings apps.
@@ -3562,14 +3497,6 @@
@Deprecated
public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON;
- /**
- * @deprecated Use {@link android.provider.Settings.Global#WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON}
- * instead.
- * {@hide}
- */
- @Deprecated
- public static final String WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON =
- Global.WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON;
/**
* @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY}
@@ -3580,15 +3507,6 @@
Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY;
/**
- * @deprecated Use {@link android.provider.Settings.Global#WIFI_COUNTRY_CODE}
- * instead.
- * @hide
- */
- @Deprecated
- public static final String WIFI_COUNTRY_CODE = Global.WIFI_COUNTRY_CODE;
-
-
- /**
* @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT}
* instead.
*/
@@ -3604,39 +3522,6 @@
public static final String WIFI_ON = Global.WIFI_ON;
/**
- * Used to save the Wifi_ON state prior to tethering.
- * This state will be checked to restore Wifi after
- * the user turns off tethering.
- *
- * @hide
- * @deprecated Use {@link android.provider.Settings.Global#WIFI_SAVED_STATE}
- * instead.
- */
- @Deprecated
- public static final String WIFI_SAVED_STATE = Global.WIFI_SAVED_STATE;
-
- /**
- * AP SSID
- *
- * @hide
- */
- public static final String WIFI_AP_SSID = "wifi_ap_ssid";
-
- /**
- * AP security
- *
- * @hide
- */
- public static final String WIFI_AP_SECURITY = "wifi_ap_security";
-
- /**
- * AP passphrase
- *
- * @hide
- */
- public static final String WIFI_AP_PASSWD = "wifi_ap_passwd";
-
- /**
* The acceptable packet loss percentage (range 0 - 100) before trying
* another AP on the same network.
* @deprecated This setting is not used.
@@ -3700,8 +3585,9 @@
public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks";
/**
- * Whether the Wi-Fi watchdog is enabled.
+ * @deprecated Use {@link android.provider.Settings.Global#WIFI_WATCHDOG_ON} instead
*/
+ @Deprecated
public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
/**
@@ -3733,66 +3619,6 @@
public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms";
/**
- * ms delay before rechecking an 'online' wifi connection when it is thought to be unstable.
- * @deprecated This setting is not used.
- * @hide
- */
- @Deprecated
- public static final String WIFI_WATCHDOG_ARP_CHECK_INTERVAL_MS =
- "wifi_watchdog_arp_interval_ms";
-
- /**
- * ms delay interval between rssi polling when the signal is known to be weak
- * @deprecated This setting is not used.
- * @hide
- */
- @Deprecated
- public static final String WIFI_WATCHDOG_RSSI_FETCH_INTERVAL_MS =
- "wifi_watchdog_rssi_fetch_interval_ms";
-
- /**
- * Number of ARP pings per check.
- * @deprecated This setting is not used.
- * @hide
- */
- @Deprecated
- public static final String WIFI_WATCHDOG_NUM_ARP_PINGS = "wifi_watchdog_num_arp_pings";
-
- /**
- * Minimum number of responses to the arp pings to consider the test 'successful'.
- * @deprecated This setting is not used.
- * @hide
- */
- @Deprecated
- public static final String WIFI_WATCHDOG_MIN_ARP_RESPONSES =
- "wifi_watchdog_min_arp_responses";
-
- /**
- * Timeout on ARP pings
- * @deprecated This setting is not used.
- * @hide
- */
- @Deprecated
- public static final String WIFI_WATCHDOG_ARP_PING_TIMEOUT_MS =
- "wifi_watchdog_arp_ping_timeout_ms";
-
- /**
- * Setting to turn off poor network avoidance on Wi-Fi. Feature is enabled by default and
- * the setting needs to be set to 0 to disable it.
- * @hide
- */
- public static final String WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED =
- "wifi_watchdog_poor_network_test_enabled";
-
- /**
- * Setting to turn on suspend optimizations at screen off on Wi-Fi. Enabled by default and
- * needs to be set to 0 to disable it.
- * @hide
- */
- public static final String WIFI_SUSPEND_OPTIMIZATIONS_ENABLED =
- "wifi_suspend_optimizations_enabled";
-
- /**
* @deprecated Use
* {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead
*/
@@ -3800,22 +3626,6 @@
public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT;
/**
- * The operational wifi frequency band
- * Set to one of {@link WifiManager#WIFI_FREQUENCY_BAND_AUTO},
- * {@link WifiManager#WIFI_FREQUENCY_BAND_5GHZ} or
- * {@link WifiManager#WIFI_FREQUENCY_BAND_2GHZ}
- *
- * @hide
- */
- public static final String WIFI_FREQUENCY_BAND = "wifi_frequency_band";
-
- /**
- * The Wi-Fi peer-to-peer device name
- * @hide
- */
- public static final String WIFI_P2P_DEVICE_NAME = "wifi_p2p_device_name";
-
- /**
* Setting to turn off captive portal detection. Feature is enabled by default and
* the setting needs to be set to 0 to disable it.
* @hide
@@ -3834,6 +3644,7 @@
* @deprecated Use
* {@link android.provider.Settings.Global#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead
*/
+ @Deprecated
public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS;
@@ -3858,27 +3669,6 @@
= "allowed_geolocation_origins";
/**
- * @deprecated Use {@link android.provider.Settings.Global#MOBILE_DATA} instead
- * @hide
- */
- @Deprecated
- public static final String MOBILE_DATA = Global.MOBILE_DATA;
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#CDMA_ROAMING_MODE} instead
- * @hide
- */
- @Deprecated
- public static final String CDMA_ROAMING_MODE = Global.CDMA_ROAMING_MODE;
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#CDMA_ROAMING_MODE} instead
- * @hide
- */
- @Deprecated
- public static final String CDMA_SUBSCRIPTION_MODE = Global.CDMA_SUBSCRIPTION_MODE;
-
- /**
* The preferred network mode 7 = Global
* 6 = EvDo only
* 5 = CDMA w/o EvDo
@@ -3902,14 +3692,6 @@
public static final String PREFERRED_TTY_MODE =
"preferred_tty_mode";
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#CDMA_CELL_BROADCAST_SMS} instead
- * @hide
- */
- @Deprecated
- public static final String CDMA_CELL_BROADCAST_SMS = Global.CDMA_CELL_BROADCAST_SMS;
-
/**
* The cdma subscription 0 = Subscription from RUIM, when available
* 1 = Subscription from NV
@@ -3982,133 +3764,6 @@
public static final String LAST_SETUP_SHOWN = "last_setup_shown";
/**
- * How frequently (in seconds) to check the memory status of the
- * device.
- * @hide
- */
- public static final String MEMCHECK_INTERVAL = "memcheck_interval";
-
- /**
- * Max frequency (in seconds) to log memory check stats, in realtime
- * seconds. This allows for throttling of logs when the device is
- * running for large amounts of time.
- * @hide
- */
- public static final String MEMCHECK_LOG_REALTIME_INTERVAL =
- "memcheck_log_realtime_interval";
-
- /**
- * Boolean indicating whether rebooting due to system memory checks
- * is enabled.
- * @hide
- */
- public static final String MEMCHECK_SYSTEM_ENABLED = "memcheck_system_enabled";
-
- /**
- * How many bytes the system process must be below to avoid scheduling
- * a soft reboot. This reboot will happen when it is next determined
- * to be a good time.
- * @hide
- */
- public static final String MEMCHECK_SYSTEM_SOFT_THRESHOLD = "memcheck_system_soft";
-
- /**
- * How many bytes the system process must be below to avoid scheduling
- * a hard reboot. This reboot will happen immediately.
- * @hide
- */
- public static final String MEMCHECK_SYSTEM_HARD_THRESHOLD = "memcheck_system_hard";
-
- /**
- * How many bytes the phone process must be below to avoid scheduling
- * a soft restart. This restart will happen when it is next determined
- * to be a good time.
- * @hide
- */
- public static final String MEMCHECK_PHONE_SOFT_THRESHOLD = "memcheck_phone_soft";
-
- /**
- * How many bytes the phone process must be below to avoid scheduling
- * a hard restart. This restart will happen immediately.
- * @hide
- */
- public static final String MEMCHECK_PHONE_HARD_THRESHOLD = "memcheck_phone_hard";
-
- /**
- * Boolean indicating whether restarting the phone process due to
- * memory checks is enabled.
- * @hide
- */
- public static final String MEMCHECK_PHONE_ENABLED = "memcheck_phone_enabled";
-
- /**
- * First time during the day it is okay to kill processes
- * or reboot the device due to low memory situations. This number is
- * in seconds since midnight.
- * @hide
- */
- public static final String MEMCHECK_EXEC_START_TIME = "memcheck_exec_start_time";
-
- /**
- * Last time during the day it is okay to kill processes
- * or reboot the device due to low memory situations. This number is
- * in seconds since midnight.
- * @hide
- */
- public static final String MEMCHECK_EXEC_END_TIME = "memcheck_exec_end_time";
-
- /**
- * How long the screen must have been off in order to kill processes
- * or reboot. This number is in seconds. A value of -1 means to
- * entirely disregard whether the screen is on.
- * @hide
- */
- public static final String MEMCHECK_MIN_SCREEN_OFF = "memcheck_min_screen_off";
-
- /**
- * How much time there must be until the next alarm in order to kill processes
- * or reboot. This number is in seconds. Note: this value must be
- * smaller than {@link #MEMCHECK_RECHECK_INTERVAL} or else it will
- * always see an alarm scheduled within its time.
- * @hide
- */
- public static final String MEMCHECK_MIN_ALARM = "memcheck_min_alarm";
-
- /**
- * How frequently to check whether it is a good time to restart things,
- * if the device is in a bad state. This number is in seconds. Note:
- * this value must be larger than {@link #MEMCHECK_MIN_ALARM} or else
- * the alarm to schedule the recheck will always appear within the
- * minimum "do not execute now" time.
- * @hide
- */
- public static final String MEMCHECK_RECHECK_INTERVAL = "memcheck_recheck_interval";
-
- /**
- * How frequently (in DAYS) to reboot the device. If 0, no reboots
- * will occur.
- * @hide
- */
- public static final String REBOOT_INTERVAL = "reboot_interval";
-
- /**
- * First time during the day it is okay to force a reboot of the
- * device (if REBOOT_INTERVAL is set). This number is
- * in seconds since midnight.
- * @hide
- */
- public static final String REBOOT_START_TIME = "reboot_start_time";
-
- /**
- * The window of time (in seconds) after each REBOOT_INTERVAL in which
- * a reboot can be executed. If 0, a reboot will always be executed at
- * exactly the given time. Otherwise, it will only be executed if
- * the device is idle within the window.
- * @hide
- */
- public static final String REBOOT_WINDOW = "reboot_window";
-
- /**
* Threshold values for the duration and level of a discharge cycle, under
* which we log discharge cycle info.
* @hide
@@ -4128,13 +3783,6 @@
public static final String SEND_ACTION_APP_ERROR = "send_action_app_error";
/**
- * @deprecated Use {@link android.provider.Settings.Global#WTF_IS_FATAL} instead
- * @hide
- */
- @Deprecated
- public static final String WTF_IS_FATAL = Global.WTF_IS_FATAL;
-
- /**
* Maximum age of entries kept by {@link com.android.internal.os.IDropBoxManagerService}.
* @hide
*/
@@ -4239,121 +3887,6 @@
public static final String WIFI_IDLE_MS = Global.WIFI_IDLE_MS;
/**
- * The interval in milliseconds to issue wake up scans when wifi needs
- * to connect. This is necessary to connect to an access point when
- * device is on the move and the screen is off.
- * @hide
- * @deprecated Use {@link android.provider.Settings.Global#WIFI_FRAMEWORK_SCAN_INTERVAL_MS}
- * instead.
- */
- @Deprecated
- public static final String WIFI_FRAMEWORK_SCAN_INTERVAL_MS =
- Global.WIFI_FRAMEWORK_SCAN_INTERVAL_MS;
-
- /**
- * The interval in milliseconds to scan as used by the wifi supplicant
- * @hide
- * @deprecated Use {@link android.provider.Settings.Global#WIFI_SUPPLICANT_SCAN_INTERVAL_MS}
- * instead.
- */
- @Deprecated
- public static final String WIFI_SUPPLICANT_SCAN_INTERVAL_MS =
- Global.WIFI_SUPPLICANT_SCAN_INTERVAL_MS;
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#PDP_WATCHDOG_POLL_INTERVAL_MS}
- * instead.
- * @hide
- */
- @Deprecated
- public static final String PDP_WATCHDOG_POLL_INTERVAL_MS =
- Global.PDP_WATCHDOG_POLL_INTERVAL_MS;
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#PDP_WATCHDOG_LONG_POLL_INTERVAL_MS}
- * instead.
- * @hide
- */
- @Deprecated
- public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS =
- Global.PDP_WATCHDOG_LONG_POLL_INTERVAL_MS;
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS}
- * instead.
- * @hide
- */
- @Deprecated
- public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS =
- Global.PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS;
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#PDP_WATCHDOG_TRIGGER_PACKET_COUNT}
- * instead.
- * @hide
- */
- @Deprecated
- public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT =
- Global.PDP_WATCHDOG_TRIGGER_PACKET_COUNT;
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#PDP_WATCHDOG_ERROR_POLL_COUNT}
- * instead.
- * @hide
- */
- @Deprecated
- public static final String PDP_WATCHDOG_ERROR_POLL_COUNT =
- Global.PDP_WATCHDOG_ERROR_POLL_COUNT;
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT}
- * instead.
- * @hide
- */
- @Deprecated
- public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT =
- Global.PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT;
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS}
- * instead.
- * @hide
- */
- @Deprecated
- public static final String DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS =
- Global.DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS;
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS}
- * instead.
- * @hide
- */
- @Deprecated
- public static final String DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS =
- Global.DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS;
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#GPRS_REGISTER_CHECK_PERIOD_MS}
- * instead.
- * @hide
- */
- @Deprecated
- public static final String GPRS_REGISTER_CHECK_PERIOD_MS =
- Global.GPRS_REGISTER_CHECK_PERIOD_MS;
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#NITZ_UPDATE_SPACING} instead
- * @hide
- */
- public static final String NITZ_UPDATE_SPACING = Global.NITZ_UPDATE_SPACING;
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#NITZ_UPDATE_SPACING} instead
- * @hide
- */
- public static final String NITZ_UPDATE_DIFF = Global.NITZ_UPDATE_DIFF;
-
- /**
* The maximum reconnect delay for short network outages or when the network is suspended
* due to phone use.
* @hide
@@ -4362,20 +3895,6 @@
"sync_max_retry_delay_in_seconds";
/**
- * @deprecated Use {@link Settings.Global#SMS_OUTGOING_CHECK_INTERVAL_MS} instead.
- * @hide
- */
- public static final String SMS_OUTGOING_CHECK_INTERVAL_MS =
- Global.SMS_OUTGOING_CHECK_INTERVAL_MS;
-
- /**
- * @deprecated Use {@link Settings.Global#SMS_OUTGOING_CHECK_MAX_COUNT} instead.
- * @hide
- */
- public static final String SMS_OUTGOING_CHECK_MAX_COUNT =
- Global.SMS_OUTGOING_CHECK_MAX_COUNT;
-
- /**
* The global search provider chosen by the user (if multiple global
* search providers are installed). This will be the provider returned
* by {@link SearchManager#getGlobalSearchActivity()} if it's still
@@ -4610,72 +4129,6 @@
public static final String DEFAULT_INSTALL_LOCATION = "default_install_location";
/**
- * @deprecated Use {@link android.provider.Settings.Global#THROTTLE_POLLING_SEC} instead
- * @hide
- */
- @Deprecated
- public static final String THROTTLE_POLLING_SEC = Global.THROTTLE_POLLING_SEC;
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#THROTTLE_THRESHOLD_BYTES} instead
- * @hide
- */
- @Deprecated
- public static final String THROTTLE_THRESHOLD_BYTES = Global.THROTTLE_THRESHOLD_BYTES;
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#THROTTLE_VALUE_KBITSPS} instead
- * @hide
- */
- @Deprecated
- public static final String THROTTLE_VALUE_KBITSPS = Global.THROTTLE_VALUE_KBITSPS;
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#THROTTLE_VALUE_KBITSPS} instead
- * @hide
- */
- @Deprecated
- public static final String THROTTLE_RESET_DAY = Global.THROTTLE_RESET_DAY;
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#THROTTLE_NOTIFICATION_TYPE} instead
- * @hide
- */
- @Deprecated
- public static final String THROTTLE_NOTIFICATION_TYPE = Global.THROTTLE_NOTIFICATION_TYPE;
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#THROTTLE_HELP_URI} instead
- * @hide
- */
- @Deprecated
- public static final String THROTTLE_HELP_URI = Global.THROTTLE_HELP_URI;
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#THROTTLE_MAX_NTP_CACHE_AGE_SEC} instead
- * @hide
- */
- @Deprecated
- public static final String THROTTLE_MAX_NTP_CACHE_AGE_SEC =
- Global.THROTTLE_MAX_NTP_CACHE_AGE_SEC;
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#DOWNLOAD_MAX_BYTES_OVER_MOBILE} instead
- * @hide
- */
- @Deprecated
- public static final String DOWNLOAD_MAX_BYTES_OVER_MOBILE =
- Global.DOWNLOAD_MAX_BYTES_OVER_MOBILE;
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE} instead
- * @hide
- */
- @Deprecated
- public static final String DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE =
- Global.DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE;
-
- /**
* ms during which to consume extra events related to Inet connection condition
* after a transtion to fully-connected
* @hide
@@ -4692,30 +4145,6 @@
"inet_condition_debounce_down_delay";
/**
- * @deprecated Use {@link android.provider.Settings.Global#SETUP_PREPAID_DATA_SERVICE_URL} instead
- * @hide
- */
- @Deprecated
- public static final String SETUP_PREPAID_DATA_SERVICE_URL =
- Global.SETUP_PREPAID_DATA_SERVICE_URL;
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#SETUP_PREPAID_DETECTION_TARGET_URL} instead
- * @hide
- */
- @Deprecated
- public static final String SETUP_PREPAID_DETECTION_TARGET_URL =
- Global.SETUP_PREPAID_DETECTION_TARGET_URL;
-
- /**
- * @deprecated Use {@link android.provider.Settings.Global#SETUP_PREPAID_DETECTION_REDIR_HOST} instead
- * @hide
- */
- @Deprecated
- public static final String SETUP_PREPAID_DETECTION_REDIR_HOST =
- Global.SETUP_PREPAID_DETECTION_REDIR_HOST;
-
- /**
* Whether screensavers are enabled.
* @hide
*/
@@ -4750,131 +4179,11 @@
*/
public static final String SCREENSAVER_DEFAULT_COMPONENT = "screensaver_default_component";
- /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
- * {@hide} */
- @Deprecated
- public static final String NETSTATS_ENABLED = Global.NETSTATS_ENABLED;
- /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
- * {@hide} */
- @Deprecated
- public static final String NETSTATS_POLL_INTERVAL = Global.NETSTATS_POLL_INTERVAL;
- /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
- * {@hide} */
- @Deprecated
- public static final String NETSTATS_TIME_CACHE_MAX_AGE = Global.NETSTATS_TIME_CACHE_MAX_AGE;
- /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
- * {@hide} */
- @Deprecated
- public static final String NETSTATS_GLOBAL_ALERT_BYTES = Global.NETSTATS_GLOBAL_ALERT_BYTES;
- /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
- * {@hide} */
- @Deprecated
- public static final String NETSTATS_SAMPLE_ENABLED = Global.NETSTATS_SAMPLE_ENABLED;
- /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
- * {@hide} */
- @Deprecated
- public static final String NETSTATS_REPORT_XT_OVER_DEV = Global.NETSTATS_REPORT_XT_OVER_DEV;
-
- /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
- * {@hide} */
- @Deprecated
- public static final String NETSTATS_DEV_BUCKET_DURATION = Global.NETSTATS_DEV_BUCKET_DURATION;
- /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
- * {@hide} */
- @Deprecated
- public static final String NETSTATS_DEV_PERSIST_BYTES = Global.NETSTATS_DEV_PERSIST_BYTES;
- /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
- * {@hide} */
- @Deprecated
- public static final String NETSTATS_DEV_ROTATE_AGE = Global.NETSTATS_DEV_ROTATE_AGE;
- /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
- * {@hide} */
- @Deprecated
- public static final String NETSTATS_DEV_DELETE_AGE = Global.NETSTATS_DEV_DELETE_AGE;
-
- /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
- * {@hide} */
- @Deprecated
- public static final String NETSTATS_UID_BUCKET_DURATION = Global.NETSTATS_UID_BUCKET_DURATION;
- /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
- * {@hide} */
- @Deprecated
- public static final String NETSTATS_UID_PERSIST_BYTES = Global.NETSTATS_UID_PERSIST_BYTES;
- /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
- * {@hide} */
- @Deprecated
- public static final String NETSTATS_UID_ROTATE_AGE = Global.NETSTATS_UID_ROTATE_AGE;
- /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
- * {@hide} */
- @Deprecated
- public static final String NETSTATS_UID_DELETE_AGE = Global.NETSTATS_UID_DELETE_AGE;
-
- /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
- * {@hide} */
- @Deprecated
- public static final String NETSTATS_UID_TAG_BUCKET_DURATION = Global.NETSTATS_UID_TAG_BUCKET_DURATION;
- /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
- * {@hide} */
- @Deprecated
- public static final String NETSTATS_UID_TAG_PERSIST_BYTES = Global.NETSTATS_UID_TAG_PERSIST_BYTES;
- /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
- * {@hide} */
- @Deprecated
- public static final String NETSTATS_UID_TAG_ROTATE_AGE = Global.NETSTATS_UID_TAG_ROTATE_AGE;
- /** @deprecated The NETSTATS_* symbols live in Settings.Global.* now
- * {@hide} */
- @Deprecated
- public static final String NETSTATS_UID_TAG_DELETE_AGE = Global.NETSTATS_UID_TAG_DELETE_AGE;
-
- /** Preferred NTP server. {@hide}
- * @deprecated moved to Settings.Global */
- public static final String NTP_SERVER = Global.NTP_SERVER;
-
- /** Timeout in milliseconds to wait for NTP server. {@hide}
- * @deprecated moved to Settings.Global */
- public static final String NTP_TIMEOUT = Global.NTP_TIMEOUT;
-
- /** Autofill server address (Used in WebView/browser).
- * @deprecated moved to Settings.Global
- * {@hide} */
- public static final String WEB_AUTOFILL_QUERY_URL = Global.WEB_AUTOFILL_QUERY_URL;
-
- /**
- * Whether the package manager should send package verification broadcasts for verifiers to
- * review apps prior to installation.
- * @deprecated moved to Settings.Global
- * 1 = request apps to be verified prior to installation, if a verifier exists.
- * 0 = do not verify apps before installation
- * {@hide}
- */
- @Deprecated
- public static final String PACKAGE_VERIFIER_ENABLE = "package_verifier_enable";
-
- /** Timeout for package verification.
- * @deprecated moved to Settings.Global
- * {@hide} */
- @Deprecated
- public static final String PACKAGE_VERIFIER_TIMEOUT = "verifier_timeout";
-
- /** Default response code for package verification.
- * @deprecated moved to Settings.Global
- * {@hide} */
- @Deprecated
- public static final String PACKAGE_VERIFIER_DEFAULT_RESPONSE = "verifier_default_response";
-
/** {@hide} */
public static final String
READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT = "read_external_storage_enforced_default";
/**
- * Duration in milliseconds before pre-authorized URIs for the contacts
- * provider should expire.
- * @hide
- */
- public static final String CONTACTS_PREAUTH_URI_EXPIRATION =
- "contacts_preauth_uri_expiration";
-
- /**
* This are the settings to be backed up.
*
* NOTE: Settings are backed up and restored in the order they appear
diff --git a/core/java/android/service/dreams/Dream.java b/core/java/android/service/dreams/Dream.java
index 473414c..590acfa 100644
--- a/core/java/android/service/dreams/Dream.java
+++ b/core/java/android/service/dreams/Dream.java
@@ -72,6 +72,12 @@
private final String TAG = Dream.class.getSimpleName() + "[" + getClass().getSimpleName() + "]";
/**
+ * The name of the dream manager service.
+ * @hide
+ */
+ public static final String DREAM_SERVICE = "dreams";
+
+ /**
* Used with {@link Intent#ACTION_MAIN} to declare the necessary intent-filter for a dream.
*
* @see Dream
@@ -499,7 +505,7 @@
// end public api
private void loadSandman() {
- mSandman = IDreamManager.Stub.asInterface(ServiceManager.getService("dreams"));
+ mSandman = IDreamManager.Stub.asInterface(ServiceManager.getService(DREAM_SERVICE));
}
private final void attach(IBinder windowToken) {
@@ -584,7 +590,7 @@
mFinished = true;
if (mSandman != null) {
- mSandman.awakenSelf(mWindowToken);
+ mSandman.finishSelf(mWindowToken);
} else {
Slog.w(TAG, "No dream manager found");
}
diff --git a/core/java/android/service/dreams/IDreamManager.aidl b/core/java/android/service/dreams/IDreamManager.aidl
index bd1c524..1c1b390 100644
--- a/core/java/android/service/dreams/IDreamManager.aidl
+++ b/core/java/android/service/dreams/IDreamManager.aidl
@@ -30,5 +30,5 @@
ComponentName getDefaultDreamComponent();
void testDream(in ComponentName componentName);
boolean isDreaming();
- void awakenSelf(in IBinder token);
+ void finishSelf(in IBinder token);
}
\ No newline at end of file
diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java
index da925c7..28763b3 100644
--- a/core/java/android/view/HardwareRenderer.java
+++ b/core/java/android/view/HardwareRenderer.java
@@ -21,6 +21,7 @@
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.SurfaceTexture;
+import android.opengl.EGL14;
import android.opengl.GLUtils;
import android.opengl.ManagedEGLContext;
import android.os.Handler;
@@ -608,12 +609,6 @@
@SuppressWarnings({"deprecation"})
static abstract class GlRenderer extends HardwareRenderer {
- // These values are not exposed in our EGL APIs
- static final int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
- static final int EGL_OPENGL_ES2_BIT = 4;
- static final int EGL_SURFACE_TYPE = 0x3033;
- static final int EGL_SWAP_BEHAVIOR_PRESERVED_BIT = 0x0400;
-
static final int SURFACE_STATE_ERROR = 0;
static final int SURFACE_STATE_SUCCESS = 1;
static final int SURFACE_STATE_UPDATED = 2;
@@ -953,19 +948,8 @@
return null;
}
- /*
- * Before we can issue GL commands, we need to make sure
- * the context is current and bound to a surface.
- */
- if (!sEgl.eglMakeCurrent(sEglDisplay, mEglSurface, mEglSurface, mEglContext)) {
- throw new Surface.OutOfResourcesException("eglMakeCurrent failed "
- + GLUtils.getEGLErrorString(sEgl.eglGetError()));
- }
-
initCaches();
- enableDirtyRegions();
-
return mEglContext.getGL();
}
@@ -990,7 +974,7 @@
abstract void initCaches();
EGLContext createContext(EGL10 egl, EGLDisplay eglDisplay, EGLConfig eglConfig) {
- int[] attribs = { EGL_CONTEXT_CLIENT_VERSION, mGlVersion, EGL_NONE };
+ int[] attribs = { EGL14.EGL_CONTEXT_CLIENT_VERSION, mGlVersion, EGL_NONE };
EGLContext context = egl.eglCreateContext(eglDisplay, eglConfig, EGL_NO_CONTEXT,
mGlVersion != 0 ? attribs : null);
@@ -1066,6 +1050,14 @@
throw new RuntimeException("createWindowSurface failed "
+ GLUtils.getEGLErrorString(error));
}
+
+ if (!sEgl.eglMakeCurrent(sEglDisplay, mEglSurface, mEglSurface, mEglContext)) {
+ throw new IllegalStateException("eglMakeCurrent failed " +
+ GLUtils.getEGLErrorString(sEgl.eglGetError()));
+ }
+
+ enableDirtyRegions();
+
return true;
}
@@ -1430,7 +1422,7 @@
@Override
int[] getConfig(boolean dirtyRegions) {
return new int[] {
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
+ EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT,
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
@@ -1439,7 +1431,7 @@
// TODO: Find a better way to choose the stencil size
EGL_STENCIL_SIZE, mShowOverdraw ? GLES20Canvas.getStencilSize() : 0,
EGL_SURFACE_TYPE, EGL_WINDOW_BIT |
- (dirtyRegions ? EGL_SWAP_BEHAVIOR_PRESERVED_BIT : 0),
+ (dirtyRegions ? EGL14.EGL_SWAP_BEHAVIOR_PRESERVED_BIT : 0),
EGL_NONE
};
}
diff --git a/core/java/android/view/ScaleGestureDetector.java b/core/java/android/view/ScaleGestureDetector.java
index 123ce2a..b0a2711 100644
--- a/core/java/android/view/ScaleGestureDetector.java
+++ b/core/java/android/view/ScaleGestureDetector.java
@@ -314,7 +314,7 @@
}
}
- final boolean configChanged =
+ final boolean configChanged = action == MotionEvent.ACTION_DOWN ||
action == MotionEvent.ACTION_POINTER_UP ||
action == MotionEvent.ACTION_POINTER_DOWN;
final boolean pointerUp = action == MotionEvent.ACTION_POINTER_UP;
@@ -344,7 +344,7 @@
if (skipIndex == i) continue;
// Average touch major and touch minor and convert the resulting diameter into a radius.
- final float touchSize = getAdjustedTouchHistory(event.getPointerId(i));
+ final float touchSize = getAdjustedTouchHistory(event.getPointerId(i)) / 2;
devSumX += Math.abs(event.getX(i) - focusX) + touchSize;
devSumY += Math.abs(event.getY(i) - focusY) + touchSize;
}
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java
index 3be63d5..0d16dd3 100644
--- a/core/java/android/view/SurfaceView.java
+++ b/core/java/android/view/SurfaceView.java
@@ -46,13 +46,18 @@
*
* <p>The surface is Z ordered so that it is behind the window holding its
* SurfaceView; the SurfaceView punches a hole in its window to allow its
- * surface to be displayed. The view hierarchy will take care of correctly
+ * surface to be displayed. The view hierarchy will take care of correctly
* compositing with the Surface any siblings of the SurfaceView that would
- * normally appear on top of it. This can be used to place overlays such as
+ * normally appear on top of it. This can be used to place overlays such as
* buttons on top of the Surface, though note however that it can have an
* impact on performance since a full alpha-blended composite will be performed
* each time the Surface changes.
*
+ * <p> The transparent region that makes the surface visible is based on the
+ * layout positions in the view hierarchy. If the post-layout transform
+ * properties are used to draw a sibling view on top of the SurfaceView, the
+ * view may not be properly composited with the surface.
+ *
* <p>Access to the underlying surface is provided via the SurfaceHolder interface,
* which can be retrieved by calling {@link #getHolder}.
*
@@ -62,14 +67,14 @@
* Surface is created and destroyed as the window is shown and hidden.
*
* <p>One of the purposes of this class is to provide a surface in which a
- * secondary thread can render into the screen. If you are going to use it
+ * secondary thread can render into the screen. If you are going to use it
* this way, you need to be aware of some threading semantics:
*
* <ul>
* <li> All SurfaceView and
* {@link SurfaceHolder.Callback SurfaceHolder.Callback} methods will be called
* from the thread running the SurfaceView's window (typically the main thread
- * of the application). They thus need to correctly synchronize with any
+ * of the application). They thus need to correctly synchronize with any
* state that is also touched by the drawing thread.
* <li> You must ensure that the drawing thread only touches the underlying
* Surface while it is valid -- between
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index ecacaca..12eb800 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -2141,6 +2141,17 @@
*/
static final int PFLAG2_PADDING_RESOLVED = 0x20000000;
+ /**
+ * Flag indicating that the start/end drawables has been resolved into left/right ones.
+ */
+ static final int PFLAG2_DRAWABLE_RESOLVED = 0x40000000;
+
+ /**
+ * Group of bits indicating that RTL properties resolution is done.
+ */
+ static final int ALL_RTL_PROPERTIES_RESOLVED = PFLAG2_LAYOUT_DIRECTION_RESOLVED |
+ PFLAG2_TEXT_DIRECTION_RESOLVED | PFLAG2_TEXT_ALIGNMENT_RESOLVED;
+
// There are a couple of flags left in mPrivateFlags2
/* End of masks for mPrivateFlags2 */
@@ -3199,9 +3210,12 @@
mResources = context != null ? context.getResources() : null;
mViewFlags = SOUND_EFFECTS_ENABLED | HAPTIC_FEEDBACK_ENABLED;
// Set layout and text direction defaults
- mPrivateFlags2 = (LAYOUT_DIRECTION_DEFAULT << PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT) |
+ mPrivateFlags2 =
+ (LAYOUT_DIRECTION_DEFAULT << PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT) |
(TEXT_DIRECTION_DEFAULT << PFLAG2_TEXT_DIRECTION_MASK_SHIFT) |
+ (PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT) |
(TEXT_ALIGNMENT_DEFAULT << PFLAG2_TEXT_ALIGNMENT_MASK_SHIFT) |
+ (PFLAG2_TEXT_ALIGNMENT_RESOLVED_DEFAULT) |
(IMPORTANT_FOR_ACCESSIBILITY_DEFAULT << PFLAG2_IMPORTANT_FOR_ACCESSIBILITY_SHIFT);
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
setOverScrollMode(OVER_SCROLL_IF_CONTENT_SCROLLS);
@@ -3419,7 +3433,8 @@
break;
case com.android.internal.R.styleable.View_layoutDirection:
// Clear any layout direction flags (included resolved bits) already set
- mPrivateFlags2 &= ~(PFLAG2_LAYOUT_DIRECTION_MASK | PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK);
+ mPrivateFlags2 &=
+ ~(PFLAG2_LAYOUT_DIRECTION_MASK | PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK);
// Set the layout direction flags depending on the value of the attribute
final int layoutDirection = a.getInt(attr, -1);
final int value = (layoutDirection != -1) ?
@@ -5772,6 +5787,8 @@
* {@link #LAYOUT_DIRECTION_INHERIT} or
* {@link #LAYOUT_DIRECTION_LOCALE}.
* @attr ref android.R.styleable#View_layoutDirection
+ *
+ * @hide
*/
@ViewDebug.ExportedProperty(category = "layout", mapping = {
@ViewDebug.IntToString(from = LAYOUT_DIRECTION_LTR, to = "LTR"),
@@ -5779,7 +5796,7 @@
@ViewDebug.IntToString(from = LAYOUT_DIRECTION_INHERIT, to = "INHERIT"),
@ViewDebug.IntToString(from = LAYOUT_DIRECTION_LOCALE, to = "LOCALE")
})
- private int getRawLayoutDirection() {
+ public int getRawLayoutDirection() {
return (mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_MASK) >> PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT;
}
@@ -5787,10 +5804,16 @@
* Set the layout direction for this view. This will propagate a reset of layout direction
* resolution to the view's children and resolve layout direction for this view.
*
- * @param layoutDirection One of {@link #LAYOUT_DIRECTION_LTR},
- * {@link #LAYOUT_DIRECTION_RTL},
- * {@link #LAYOUT_DIRECTION_INHERIT} or
- * {@link #LAYOUT_DIRECTION_LOCALE}.
+ * @param layoutDirection the layout direction to set. Should be one of:
+ *
+ * {@link #LAYOUT_DIRECTION_LTR},
+ * {@link #LAYOUT_DIRECTION_RTL},
+ * {@link #LAYOUT_DIRECTION_INHERIT},
+ * {@link #LAYOUT_DIRECTION_LOCALE}.
+ *
+ * Resolution will be done if the value is set to LAYOUT_DIRECTION_INHERIT. The resolution
+ * proceeds up the parent chain of the view to get the value. If there is no parent, then it
+ * will return the default {@link #LAYOUT_DIRECTION_LTR}.
*
* @attr ref android.R.styleable#View_layoutDirection
*/
@@ -5803,11 +5826,8 @@
// Set the new layout direction (filtered)
mPrivateFlags2 |=
((layoutDirection << PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT) & PFLAG2_LAYOUT_DIRECTION_MASK);
- resolveRtlProperties();
- // Notify changes
- onRtlPropertiesChanged();
- // ... and ask for a layout pass
- requestLayout();
+ // We need to resolve all RTL properties as they all depend on layout direction
+ resolveRtlPropertiesIfNeeded();
}
}
@@ -5816,6 +5836,9 @@
*
* @return {@link #LAYOUT_DIRECTION_RTL} if the layout direction is RTL or returns
* {@link #LAYOUT_DIRECTION_LTR} if the layout direction is not RTL.
+ *
+ * For compatibility, this will return {@link #LAYOUT_DIRECTION_LTR} if API version
+ * is lower than {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}.
*/
@ViewDebug.ExportedProperty(category = "layout", mapping = {
@ViewDebug.IntToString(from = LAYOUT_DIRECTION_LTR, to = "RESOLVED_DIRECTION_LTR"),
@@ -5827,12 +5850,8 @@
mPrivateFlags2 |= PFLAG2_LAYOUT_DIRECTION_RESOLVED;
return LAYOUT_DIRECTION_LTR;
}
- // The layout direction will be resolved only if needed
- if ((mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_RESOLVED) != PFLAG2_LAYOUT_DIRECTION_RESOLVED) {
- resolveLayoutDirection();
- }
- return ((mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL) == PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL) ?
- LAYOUT_DIRECTION_RTL : LAYOUT_DIRECTION_LTR;
+ return ((mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL) ==
+ PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL) ? LAYOUT_DIRECTION_RTL : LAYOUT_DIRECTION_LTR;
}
/**
@@ -11474,10 +11493,6 @@
jumpDrawablesToCurrentState();
- resolveRtlProperties();
- // Notify changes
- onRtlPropertiesChanged();
-
clearAccessibilityFocus();
if (isFocused()) {
InputMethodManager imm = InputMethodManager.peekInstance();
@@ -11490,25 +11505,41 @@
}
/**
- * Resolve all RTL related properties
+ * Resolve all RTL related properties.
*/
- void resolveRtlProperties() {
- // Order is important here: LayoutDirection MUST be resolved first...
- resolveLayoutDirection();
+ void resolveRtlPropertiesIfNeeded() {
+ if (!needRtlPropertiesResolution()) return;
+
+ // Order is important here: LayoutDirection MUST be resolved first
+ if (!isLayoutDirectionResolved()) {
+ resolveLayoutDirection();
+ resolveLayoutParams();
+ }
// ... then we can resolve the others properties depending on the resolved LayoutDirection.
- resolveTextDirection();
- resolveTextAlignment();
- resolvePadding();
- resolveLayoutParams();
- resolveDrawables();
+ if (!isTextDirectionResolved()) {
+ resolveTextDirection();
+ }
+ if (!isTextAlignmentResolved()) {
+ resolveTextAlignment();
+ }
+ if (!isPaddingResolved()) {
+ resolvePadding();
+ }
+ if (!isDrawablesResolved()) {
+ resolveDrawables();
+ }
+ requestLayout();
+ invalidate(true);
+ onRtlPropertiesChanged();
}
- // Reset resolution of all RTL related properties
+ // Reset resolution of all RTL related properties.
void resetRtlProperties() {
resetResolvedLayoutDirection();
resetResolvedTextDirection();
resetResolvedTextAlignment();
resetResolvedPadding();
+ resetResolvedDrawables();
}
/**
@@ -11538,6 +11569,13 @@
}
/**
+ * @return true if RTL properties need resolution.
+ */
+ private boolean needRtlPropertiesResolution() {
+ return (mPrivateFlags2 & ALL_RTL_PROPERTIES_RESOLVED) != ALL_RTL_PROPERTIES_RESOLVED;
+ }
+
+ /**
* Called when any RTL property (layout direction or text direction or text alignment) has
* been changed.
*
@@ -11614,7 +11652,8 @@
}
/**
- * Reset the resolved layout direction.
+ * Reset the resolved layout direction. Layout direction will be resolved during a call to
+ * {@link #onMeasure(int, int)}.
*
* @hide
*/
@@ -11624,6 +11663,8 @@
}
/**
+ * @return true if the layout direction is inherited.
+ *
* @hide
*/
public boolean isLayoutDirectionInherited() {
@@ -11631,12 +11672,19 @@
}
/**
+ * @return true if layout direction has been resolved.
+ */
+ private boolean isLayoutDirectionResolved() {
+ return (mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_RESOLVED) == PFLAG2_LAYOUT_DIRECTION_RESOLVED;
+ }
+
+ /**
* Return if padding has been resolved
*
* @hide
*/
boolean isPaddingResolved() {
- return (mPrivateFlags2 & PFLAG2_PADDING_RESOLVED) != 0;
+ return (mPrivateFlags2 & PFLAG2_PADDING_RESOLVED) == PFLAG2_PADDING_RESOLVED;
}
/**
@@ -14116,6 +14164,7 @@
if (mBackground != null) {
mBackground.setLayoutDirection(getLayoutDirection());
}
+ mPrivateFlags2 |= PFLAG2_DRAWABLE_RESOLVED;
onResolveDrawables(getLayoutDirection());
}
@@ -14134,6 +14183,14 @@
public void onResolveDrawables(int layoutDirection) {
}
+ private void resetResolvedDrawables() {
+ mPrivateFlags2 &= ~PFLAG2_DRAWABLE_RESOLVED;
+ }
+
+ private boolean isDrawablesResolved() {
+ return (mPrivateFlags2 & PFLAG2_DRAWABLE_RESOLVED) == PFLAG2_DRAWABLE_RESOLVED;
+ }
+
/**
* If your view subclass is displaying its own Drawable objects, it should
* override this function and return true for any Drawable it is
@@ -14403,6 +14460,7 @@
padding = new Rect();
sThreadLocal.set(padding);
}
+ resetResolvedDrawables();
background.setLayoutDirection(getLayoutDirection());
if (background.getPadding(padding)) {
resetResolvedPadding();
@@ -15379,9 +15437,7 @@
// first clears the measured dimension flag
mPrivateFlags &= ~PFLAG_MEASURED_DIMENSION_SET;
- if (!isPaddingResolved()) {
- resolvePadding();
- }
+ resolveRtlPropertiesIfNeeded();
// measure ourselves, this should set the measured dimension flag back
onMeasure(widthMeasureSpec, heightMeasureSpec);
@@ -16526,6 +16582,10 @@
* {@link #TEXT_DIRECTION_LTR},
* {@link #TEXT_DIRECTION_RTL},
* {@link #TEXT_DIRECTION_LOCALE}
+ *
+ * Resolution will be done if the value is set to TEXT_DIRECTION_INHERIT. The resolution
+ * proceeds up the parent chain of the view to get the value. If there is no parent, then it will
+ * return the default {@link #TEXT_DIRECTION_FIRST_STRONG}.
*/
public void setTextDirection(int textDirection) {
if (getRawTextDirection() != textDirection) {
@@ -16534,6 +16594,8 @@
resetResolvedTextDirection();
// Set the new text direction
mPrivateFlags2 |= ((textDirection << PFLAG2_TEXT_DIRECTION_MASK_SHIFT) & PFLAG2_TEXT_DIRECTION_MASK);
+ // Do resolution
+ resolveTextDirection();
// Notify change
onRtlPropertiesChanged();
// Refresh
@@ -16545,11 +16607,6 @@
/**
* Return the resolved text direction.
*
- * This needs resolution if the value is TEXT_DIRECTION_INHERIT. The resolution matches what has
- * been set by {@link #setTextDirection(int)} if it is not TEXT_DIRECTION_INHERIT, otherwise the
- * resolution proceeds up the parent chain of the view. If there is no parent, then it will
- * return the default {@link #TEXT_DIRECTION_FIRST_STRONG}.
- *
* @return the resolved text direction. Returns one of:
*
* {@link #TEXT_DIRECTION_FIRST_STRONG}
@@ -16559,10 +16616,6 @@
* {@link #TEXT_DIRECTION_LOCALE}
*/
public int getTextDirection() {
- // The text direction will be resolved only if needed
- if ((mPrivateFlags2 & PFLAG2_TEXT_DIRECTION_RESOLVED) != PFLAG2_TEXT_DIRECTION_RESOLVED) {
- resolveTextDirection();
- }
return (mPrivateFlags2 & PFLAG2_TEXT_DIRECTION_RESOLVED_MASK) >> PFLAG2_TEXT_DIRECTION_RESOLVED_MASK_SHIFT;
}
@@ -16601,6 +16654,8 @@
} else {
// We cannot do the resolution if there is no parent, so use the default one
mPrivateFlags2 |= PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
+ // Resolution will need to happen again later
+ return;
}
break;
case TEXT_DIRECTION_FIRST_STRONG:
@@ -16639,16 +16694,21 @@
}
/**
- * Reset resolved text direction. Text direction can be resolved with a call to
- * getTextDirection().
+ * Reset resolved text direction. Text direction will be resolved during a call to
+ * {@link #onMeasure(int, int)}.
*
* @hide
*/
public void resetResolvedTextDirection() {
+ // Reset any previous text direction resolution
mPrivateFlags2 &= ~(PFLAG2_TEXT_DIRECTION_RESOLVED | PFLAG2_TEXT_DIRECTION_RESOLVED_MASK);
+ // Set to default value
+ mPrivateFlags2 |= PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
}
/**
+ * @return true if text direction is inherited.
+ *
* @hide
*/
public boolean isTextDirectionInherited() {
@@ -16656,6 +16716,13 @@
}
/**
+ * @return true if text direction is resolved.
+ */
+ private boolean isTextDirectionResolved() {
+ return (mPrivateFlags2 & PFLAG2_TEXT_DIRECTION_RESOLVED) == PFLAG2_TEXT_DIRECTION_RESOLVED;
+ }
+
+ /**
* Return the value specifying the text alignment or policy that was set with
* {@link #setTextAlignment(int)}.
*
@@ -16697,6 +16764,10 @@
* {@link #TEXT_ALIGNMENT_VIEW_START},
* {@link #TEXT_ALIGNMENT_VIEW_END}
*
+ * Resolution will be done if the value is set to TEXT_ALIGNMENT_INHERIT. The resolution
+ * proceeds up the parent chain of the view to get the value. If there is no parent, then it
+ * will return the default {@link #TEXT_ALIGNMENT_GRAVITY}.
+ *
* @attr ref android.R.styleable#View_textAlignment
*/
public void setTextAlignment(int textAlignment) {
@@ -16705,7 +16776,10 @@
mPrivateFlags2 &= ~PFLAG2_TEXT_ALIGNMENT_MASK;
resetResolvedTextAlignment();
// Set the new text alignment
- mPrivateFlags2 |= ((textAlignment << PFLAG2_TEXT_ALIGNMENT_MASK_SHIFT) & PFLAG2_TEXT_ALIGNMENT_MASK);
+ mPrivateFlags2 |=
+ ((textAlignment << PFLAG2_TEXT_ALIGNMENT_MASK_SHIFT) & PFLAG2_TEXT_ALIGNMENT_MASK);
+ // Do resolution
+ resolveTextAlignment();
// Notify change
onRtlPropertiesChanged();
// Refresh
@@ -16717,10 +16791,6 @@
/**
* Return the resolved text alignment.
*
- * The resolved text alignment. This needs resolution if the value is
- * TEXT_ALIGNMENT_INHERIT. The resolution matches {@link #setTextAlignment(int)} if it is
- * not TEXT_ALIGNMENT_INHERIT, otherwise resolution proceeds up the parent chain of the view.
- *
* @return the resolved text alignment. Returns one of:
*
* {@link #TEXT_ALIGNMENT_GRAVITY},
@@ -16740,11 +16810,8 @@
@ViewDebug.IntToString(from = TEXT_ALIGNMENT_VIEW_END, to = "VIEW_END")
})
public int getTextAlignment() {
- // If text alignment is not resolved, then resolve it
- if ((mPrivateFlags2 & PFLAG2_TEXT_ALIGNMENT_RESOLVED) != PFLAG2_TEXT_ALIGNMENT_RESOLVED) {
- resolveTextAlignment();
- }
- return (mPrivateFlags2 & PFLAG2_TEXT_ALIGNMENT_RESOLVED_MASK) >> PFLAG2_TEXT_ALIGNMENT_RESOLVED_MASK_SHIFT;
+ return (mPrivateFlags2 & PFLAG2_TEXT_ALIGNMENT_RESOLVED_MASK) >>
+ PFLAG2_TEXT_ALIGNMENT_RESOLVED_MASK_SHIFT;
}
/**
@@ -16786,6 +16853,8 @@
else {
// We cannot do the resolution if there is no parent so use the default
mPrivateFlags2 |= PFLAG2_TEXT_ALIGNMENT_RESOLVED_DEFAULT;
+ // Resolution will need to happen again later
+ return;
}
break;
case TEXT_ALIGNMENT_GRAVITY:
@@ -16825,16 +16894,21 @@
}
/**
- * Reset resolved text alignment.
+ * Reset resolved text alignment. Text alignment will be resolved during a call to
+ * {@link #onMeasure(int, int)}.
*
* @hide
*/
public void resetResolvedTextAlignment() {
// Reset any previous text alignment resolution
mPrivateFlags2 &= ~(PFLAG2_TEXT_ALIGNMENT_RESOLVED | PFLAG2_TEXT_ALIGNMENT_RESOLVED_MASK);
+ // Set to default
+ mPrivateFlags2 |= PFLAG2_TEXT_ALIGNMENT_RESOLVED_DEFAULT;
}
/**
+ * @return true if text alignment is inherited.
+ *
* @hide
*/
public boolean isTextAlignmentInherited() {
@@ -16842,6 +16916,13 @@
}
/**
+ * @return true if text alignment is resolved.
+ */
+ private boolean isTextAlignmentResolved() {
+ return (mPrivateFlags2 & PFLAG2_TEXT_ALIGNMENT_RESOLVED) == PFLAG2_TEXT_ALIGNMENT_RESOLVED;
+ }
+
+ /**
* Generate a value suitable for use in {@link #setId(int)}.
* This value will not collide with ID values generated at build time by aapt for R.id.
*
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 34411ea..41890d6 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -3391,11 +3391,6 @@
if (child.hasTransientState()) {
childHasTransientStateChanged(child, true);
}
-
- if (child.isLayoutDirectionInherited()) {
- child.resetResolvedLayoutDirection();
- child.resolveRtlProperties();
- }
}
private void addInArray(View child, int index) {
@@ -3621,7 +3616,7 @@
childHasTransientStateChanged(view, false);
}
- view.resetResolvedLayoutDirection();
+ view.resetRtlProperties();
onViewRemoved(view);
@@ -5261,19 +5256,92 @@
* @hide
*/
@Override
+ public void resolveLayoutDirection() {
+ super.resolveLayoutDirection();
+
+ int count = getChildCount();
+ for (int i = 0; i < count; i++) {
+ final View child = getChildAt(i);
+ if (child.isLayoutDirectionInherited()) {
+ child.resolveLayoutDirection();
+ }
+ }
+ }
+
+ /**
+ * @hide
+ */
+ @Override
+ public void resolveTextDirection() {
+ super.resolveTextDirection();
+
+ int count = getChildCount();
+ for (int i = 0; i < count; i++) {
+ final View child = getChildAt(i);
+ if (child.isTextDirectionInherited()) {
+ child.resolveTextDirection();
+ }
+ }
+ }
+
+ /**
+ * @hide
+ */
+ @Override
+ public void resolveTextAlignment() {
+ super.resolveTextAlignment();
+
+ int count = getChildCount();
+ for (int i = 0; i < count; i++) {
+ final View child = getChildAt(i);
+ if (child.isTextAlignmentInherited()) {
+ child.resolveTextAlignment();
+ }
+ }
+ }
+
+ /**
+ * @hide
+ */
+ @Override
public void resetResolvedLayoutDirection() {
super.resetResolvedLayoutDirection();
- // Take care of resetting the children resolution too
int count = getChildCount();
for (int i = 0; i < count; i++) {
final View child = getChildAt(i);
if (child.isLayoutDirectionInherited()) {
child.resetResolvedLayoutDirection();
}
+ }
+ }
+
+ /**
+ * @hide
+ */
+ @Override
+ public void resetResolvedTextDirection() {
+ super.resetResolvedTextDirection();
+
+ int count = getChildCount();
+ for (int i = 0; i < count; i++) {
+ final View child = getChildAt(i);
if (child.isTextDirectionInherited()) {
child.resetResolvedTextDirection();
}
+ }
+ }
+
+ /**
+ * @hide
+ */
+ @Override
+ public void resetResolvedTextAlignment() {
+ super.resetResolvedTextAlignment();
+
+ int count = getChildCount();
+ for (int i = 0; i < count; i++) {
+ final View child = getChildAt(i);
if (child.isTextAlignmentInherited()) {
child.resetResolvedTextAlignment();
}
diff --git a/core/java/android/widget/ImageView.java b/core/java/android/widget/ImageView.java
index 87396fb..7ca8322 100644
--- a/core/java/android/widget/ImageView.java
+++ b/core/java/android/widget/ImageView.java
@@ -789,6 +789,7 @@
if (resizeWidth) {
int newWidth = (int)(desiredAspect * (heightSize - ptop - pbottom)) +
pleft + pright;
+ widthSize = resolveAdjustedSize(newWidth, mMaxWidth, widthMeasureSpec);
if (newWidth <= widthSize) {
widthSize = newWidth;
done = true;
@@ -799,6 +800,7 @@
if (!done && resizeHeight) {
int newHeight = (int)((widthSize - pleft - pright) / desiredAspect) +
ptop + pbottom;
+ heightSize = resolveAdjustedSize(newHeight, mMaxHeight, heightMeasureSpec);
if (newHeight <= heightSize) {
heightSize = newHeight;
}
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java
index 90f55bf..4b5dfb8 100644
--- a/core/java/android/widget/RemoteViews.java
+++ b/core/java/android/widget/RemoteViews.java
@@ -2166,6 +2166,8 @@
* @param value The value to pass to the method.
*/
public void setUri(int viewId, String methodName, Uri value) {
+ // Resolve any filesystem path before sending remotely
+ value = value.getCanonicalUri();
addAction(new ReflectionAction(viewId, methodName, ReflectionAction.URI, value));
}
diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java
index bffbe11..4ad0819 100644
--- a/core/java/com/android/internal/app/ResolverActivity.java
+++ b/core/java/com/android/internal/app/ResolverActivity.java
@@ -436,9 +436,10 @@
if (mBaseResolveList != null) {
mCurrentResolveList = mBaseResolveList;
} else {
- mCurrentResolveList = mPm.queryIntentActivities(
+ mCurrentResolveList = mPm.queryIntentActivitiesAsUser(
mIntent, PackageManager.MATCH_DEFAULT_ONLY
- | (mAlwaysUseOption ? PackageManager.GET_RESOLVED_FILTER : 0));
+ | (mAlwaysUseOption ? PackageManager.GET_RESOLVED_FILTER : 0),
+ UserHandle.getUserId(mLaunchedFromUid));
// Filter out any activities that the launched uid does not
// have permission for. We don't do this when we have an explicit
// list of resolved activities, because that only happens when
diff --git a/core/jni/android_os_SystemClock.cpp b/core/jni/android_os_SystemClock.cpp
index 78f989a..5c135ee 100644
--- a/core/jni/android_os_SystemClock.cpp
+++ b/core/jni/android_os_SystemClock.cpp
@@ -137,7 +137,7 @@
(void*) android_os_SystemClock_currentThreadTimeMicro },
{ "currentTimeMicro", "()J",
(void*) android_os_SystemClock_currentTimeMicro },
- { "elapsedRealtimeNano", "()J",
+ { "elapsedRealtimeNanos", "()J",
(void*) android_os_SystemClock_elapsedRealtimeNano },
};
int register_android_os_SystemClock(JNIEnv* env)
diff --git a/core/res/res/values-af/strings.xml b/core/res/res/values-af/strings.xml
index 0bedb03..db96ff68 100644
--- a/core/res/res/values-af/strings.xml
+++ b/core/res/res/values-af/strings.xml
@@ -1072,8 +1072,7 @@
<item quantity="other" msgid="7915895323644292768">"Oop Wi-Fi-netwerke beskikbaar"</item>
</plurals>
<string name="wifi_available_sign_in" msgid="4029489716605255386">"Meld aan by Wi-Fi-netwerk"</string>
- <!-- no translation found for network_available_sign_in (8495155593358054676) -->
- <skip />
+ <string name="network_available_sign_in" msgid="8495155593358054676">"Meld aan by netwerk"</string>
<!-- no translation found for network_available_sign_in_detailed (8000081941447976118) -->
<skip />
<string name="wifi_watchdog_network_disabled" msgid="7904214231651546347">"Kon nie aan Wi-Fikoppel nie"</string>
@@ -1091,8 +1090,7 @@
<string name="wifi_p2p_to_message" msgid="248968974522044099">"Aan:"</string>
<string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Voer die vereiste PIN in:"</string>
<string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
- <!-- no translation found for wifi_p2p_frequency_conflict_message (7363907213787469151) -->
- <skip />
+ <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Die telefoon sal tydelik van Wi-Fi ontkoppel terwyl dit aan <xliff:g id="DEVICE_NAME">%1$s</xliff:g> gekoppel is"</string>
<string name="select_character" msgid="3365550120617701745">"Voeg karakter in"</string>
<string name="sms_control_title" msgid="7296612781128917719">"Stuur SMS-boodskappe"</string>
<string name="sms_control_message" msgid="3867899169651496433">"<b><xliff:g id="APP_NAME">%1$s</xliff:g></b> stuur \'n groot aantal SMS-boodskappe. Wil jy hierdie program toelaat om voort te gaan om boodskappe te stuur?"</string>
diff --git a/core/res/res/values-ar/strings.xml b/core/res/res/values-ar/strings.xml
index 7cf8787..a6ac577 100644
--- a/core/res/res/values-ar/strings.xml
+++ b/core/res/res/values-ar/strings.xml
@@ -320,7 +320,7 @@
<string name="permlab_internalSystemWindow" msgid="2148563628140193231">"عرض النوافذ غير المصرح بها"</string>
<string name="permdesc_internalSystemWindow" msgid="7458387759461466397">"للسماح للتطبيق بإنشاء نوافذ بقصد استخدامها بواسطة واجهة مستخدم النظام الداخلي. ليس للاستخدام بواسطة التطبيقات العادية."</string>
<string name="permlab_systemAlertWindow" msgid="3543347980839518613">"التغطية على تطبيقات أخرى"</string>
- <string name="permdesc_systemAlertWindow" msgid="8584678381972820118">"للسماح للتطبيق بالرسم على التطبيقات الأخرى أو أجزاء من واجهة المستخدم. وقد تتداخل مع استخدامك للواجهة في أي تطبيق أو قد تغير ما تعتقد أنك تراه في التطبيقات الأخرى."</string>
+ <string name="permdesc_systemAlertWindow" msgid="8584678381972820118">"للسماح بوضع التطبيق بالقرب أعلى التطبيقات الأخرى أو في أجزاء من واجهة المستخدم. وقد يتداخل مع استخدامك للواجهة في أي تطبيق أو قد يغير ما تعتقد أنك تراه في التطبيقات الأخرى."</string>
<string name="permlab_setAnimationScale" msgid="2805103241153907174">"تعديل سرعة الرسوم المتحركة العمومية"</string>
<string name="permdesc_setAnimationScale" msgid="7690063428924343571">"للسماح للتطبيق بتغيير سرعة الرسوم المتحركة العمومية (رسوم متحركة أسرع أو أبطأ) في أي وقت."</string>
<string name="permlab_manageAppTokens" msgid="1286505717050121370">"إدارة الرموز المميزة للتطبيقات"</string>
@@ -431,9 +431,9 @@
<string name="permlab_installLocationProvider" msgid="6578101199825193873">"إذن لتثبيت موفر خدمة موقع"</string>
<string name="permdesc_installLocationProvider" msgid="9066146120470591509">"لإنشاء مصادر مواقع زائفة للاختبار أو تثبيت موفر مواقع جديد. يتيح هذا للتطبيق إلغاء الموقع و/أو الحالة التي تعرضها مصادر المواقع الأخرى مثل GPS أو موفري المواقع."</string>
<string name="permlab_accessFineLocation" msgid="1191898061965273372">"الموقع الدقيق (مستند إلى نظام تحديد المواقع العالمي والشبكة)"</string>
- <string name="permdesc_accessFineLocation" msgid="5295047563564981250">"للسماح للتطبيق بتحديد موقعك بدقة وهذا باستخدام نظام تحديد المواقع العالمي (GPS) أو مصادر المواقع التي تستخدم الشبكات مثل الأبراج الخلوية أو تقنية Wi-Fi. يتعين توفر خدمات المواقع هذه وتشغيلها على جهازك للتطبيق كي يستخدمها. وقد تستخدم التطبيقات هذا لتحديد موقعك وقد تستهلك مزيدًا من طاقة البطارية."</string>
+ <string name="permdesc_accessFineLocation" msgid="5295047563564981250">"للسماح للتطبيق بتحديد موقعك بدقة وهذا باستخدام نظام تحديد المواقع العالمي (GPS) أو مصادر المواقع التي تستخدم الشبكات مثل أبراج الجوال أو تقنية Wi-Fi. يتعين توفر خدمات المواقع هذه وتشغيلها على جهازك للتطبيق كي يستخدمها. وقد تستخدم التطبيقات هذا لتحديد موقعك وقد تستهلك مزيدًا من طاقة البطارية."</string>
<string name="permlab_accessCoarseLocation" msgid="4887895362354239628">"الموقع التقريبي (مستند إلى الشبكة)"</string>
- <string name="permdesc_accessCoarseLocation" msgid="2538200184373302295">"للسماح للتطبيق بتحديد موقعك التقريبي الذي يستمد من خدمات الموقع باستخدام مصادر المواقع التي تستخدم الشبكات مثل الأبراج الخلوية وتقنية Wi-Fi. يتعين توفر خدمات المواقع هذه وتشغيلها على جهازك للتطبيق كي يستخدمها. وقد تستخدم التطبيقات هذا لتحديد موقعك التقريبي."</string>
+ <string name="permdesc_accessCoarseLocation" msgid="2538200184373302295">"للسماح للتطبيق بتحديد موقعك التقريبي الذي يستمد من خدمات الموقع باستخدام مصادر المواقع التي تستخدم الشبكات مثل أبراج الجوال وتقنية Wi-Fi. يتعين توفر خدمات المواقع هذه وتشغيلها على جهازك للتطبيق كي يستخدمها. وقد تستخدم التطبيقات هذا لتحديد موقعك التقريبي."</string>
<string name="permlab_accessSurfaceFlinger" msgid="2363969641792388947">"الدخول إلى SurfaceFlinger"</string>
<string name="permdesc_accessSurfaceFlinger" msgid="1041619516733293551">"للسماح للتطبيق باستخدام ميزات SurfaceFlinger ذات المستوى المنخفض."</string>
<string name="permlab_readFrameBuffer" msgid="6690504248178498136">"قراءة المخزن المؤقت للإطارات"</string>
diff --git a/core/res/res/values-bg/strings.xml b/core/res/res/values-bg/strings.xml
index 06de90b2..b620b50d 100644
--- a/core/res/res/values-bg/strings.xml
+++ b/core/res/res/values-bg/strings.xml
@@ -1072,8 +1072,7 @@
<item quantity="other" msgid="7915895323644292768">"Има достъпни отворени Wi-Fi мрежи"</item>
</plurals>
<string name="wifi_available_sign_in" msgid="4029489716605255386">"Влизане в Wi-Fi мрежа"</string>
- <!-- no translation found for network_available_sign_in (8495155593358054676) -->
- <skip />
+ <string name="network_available_sign_in" msgid="8495155593358054676">"Влезте в мрежата"</string>
<!-- no translation found for network_available_sign_in_detailed (8000081941447976118) -->
<skip />
<string name="wifi_watchdog_network_disabled" msgid="7904214231651546347">"Не можа да се свърже с Wi-Fi"</string>
@@ -1091,8 +1090,7 @@
<string name="wifi_p2p_to_message" msgid="248968974522044099">"До:"</string>
<string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Въведете задължителния ПИН:"</string>
<string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"ПИН:"</string>
- <!-- no translation found for wifi_p2p_frequency_conflict_message (7363907213787469151) -->
- <skip />
+ <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Телефонът временно ще прекрати връзката с Wi-Fi, докато е свързан с/ъс <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
<string name="select_character" msgid="3365550120617701745">"Вмъкване на знак"</string>
<string name="sms_control_title" msgid="7296612781128917719">"Изпращане на SMS съобщения"</string>
<string name="sms_control_message" msgid="3867899169651496433">"<b><xliff:g id="APP_NAME">%1$s</xliff:g></b> изпраща голям брой SMS съобщения. Искате ли да разрешите на това приложение да продължи да го прави?"</string>
diff --git a/core/res/res/values-ca/strings.xml b/core/res/res/values-ca/strings.xml
index 0bfca00..a63e418 100644
--- a/core/res/res/values-ca/strings.xml
+++ b/core/res/res/values-ca/strings.xml
@@ -1150,7 +1150,7 @@
<string name="extmedia_format_button_format" msgid="4131064560127478695">"Formata"</string>
<string name="adb_active_notification_title" msgid="6729044778949189918">"Depuració d\'USB connectada"</string>
<string name="adb_active_notification_message" msgid="1016654627626476142">"Toca-ho per desactivar la depuració USB."</string>
- <string name="select_input_method" msgid="4653387336791222978">"Selecció de mètodes d\'introducció"</string>
+ <string name="select_input_method" msgid="4653387336791222978">"Selecciona un mètodes d\'entrada"</string>
<string name="configure_input_methods" msgid="9091652157722495116">"Configura els mètodes d\'entrada"</string>
<string name="use_physical_keyboard" msgid="6203112478095117625">"Teclat físic"</string>
<string name="hardware" msgid="7517821086888990278">"Maquinari"</string>
@@ -1405,6 +1405,6 @@
<string name="kg_failed_attempts_now_wiping" product="default" msgid="4817627474419471518">"Has provat de desbloquejar el telèfon <xliff:g id="NUMBER">%d</xliff:g> vegades de manera incorrecta. Ara el telèfon es restablirà a la configuració predeterminada de fàbrica."</string>
<string name="kg_failed_attempts_almost_at_login" product="tablet" msgid="3253575572118914370">"Has dibuixat el patró de desbloqueig <xliff:g id="NUMBER_0">%d</xliff:g> vegades de manera incorrecta. Després de <xliff:g id="NUMBER_1">%d</xliff:g> intents incorrectes més, se\'t demanarà que desbloquegis la tauleta amb un compte de correu electrònic."\n\n" Torna-ho a provar d\'aquí a <xliff:g id="NUMBER_2">%d</xliff:g> segons."</string>
<string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Has dibuixat el patró de desbloqueig <xliff:g id="NUMBER_0">%d</xliff:g> vegades de manera incorrecta. Després de <xliff:g id="NUMBER_1">%d</xliff:g> intents incorrectes més, se\'t demanarà que desbloquegis el telèfon amb un compte de correu electrònic."\n\n" Torna-ho a provar d\'aquí a <xliff:g id="NUMBER_2">%d</xliff:g> segons."</string>
- <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Vols augmentar el volum per sobre del nivell de seguretat?"\n"Escoltar música a un volum alt durant períodes llargs pot danyar l\'oïda."</string>
+ <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Vols augmentar el volum per sobre del nivell de seguretat?"\n"Escoltar música a un volum alt durant períodes llargs pot perjudicar l\'oïda."</string>
<string name="kg_temp_back_string" msgid="5812983904056640466">"<"</string>
</resources>
diff --git a/core/res/res/values-cs/strings.xml b/core/res/res/values-cs/strings.xml
index 2ad8153..2d53182 100644
--- a/core/res/res/values-cs/strings.xml
+++ b/core/res/res/values-cs/strings.xml
@@ -1072,8 +1072,7 @@
<item quantity="other" msgid="7915895323644292768">"Jsou k dispozici veřejné sítě WiFi"</item>
</plurals>
<string name="wifi_available_sign_in" msgid="4029489716605255386">"Přihlásit se k síti Wi-Fi"</string>
- <!-- no translation found for network_available_sign_in (8495155593358054676) -->
- <skip />
+ <string name="network_available_sign_in" msgid="8495155593358054676">"Přihlášení k síti"</string>
<!-- no translation found for network_available_sign_in_detailed (8000081941447976118) -->
<skip />
<string name="wifi_watchdog_network_disabled" msgid="7904214231651546347">"Připojení k síti Wi-Fi se nezdařilo"</string>
@@ -1091,8 +1090,7 @@
<string name="wifi_p2p_to_message" msgid="248968974522044099">"Komu:"</string>
<string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Zadejte požadovaný kód PIN:"</string>
<string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
- <!-- no translation found for wifi_p2p_frequency_conflict_message (7363907213787469151) -->
- <skip />
+ <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Telefon se při připojení k zařízení <xliff:g id="DEVICE_NAME">%1$s</xliff:g> dočasně odpojí od sítě Wi-Fi"</string>
<string name="select_character" msgid="3365550120617701745">"Vkládání znaků"</string>
<string name="sms_control_title" msgid="7296612781128917719">"Odesílání zpráv SMS"</string>
<string name="sms_control_message" msgid="3867899169651496433">"Aplikace <b><xliff:g id="APP_NAME">%1$s</xliff:g></b>odesílá velký počet SMS zpráv. Chcete aplikaci povolit, aby zprávy odesílala i nadále?"</string>
diff --git a/core/res/res/values-es-rUS/strings.xml b/core/res/res/values-es-rUS/strings.xml
index cff81ea..5cc025a 100644
--- a/core/res/res/values-es-rUS/strings.xml
+++ b/core/res/res/values-es-rUS/strings.xml
@@ -276,7 +276,7 @@
<string name="permlab_changeConfiguration" msgid="4162092185124234480">"cambiar la configuración de visualización del sistema"</string>
<string name="permdesc_changeConfiguration" msgid="4372223873154296076">"Permite que la aplicación cambie la configuración actual como, por ejemplo, la configuración regional o el tamaño de fuente general."</string>
<string name="permlab_enableCarMode" msgid="5684504058192921098">"activar el modo de auto"</string>
- <string name="permdesc_enableCarMode" msgid="4853187425751419467">"Permite que la aplicación habilite el modo coche."</string>
+ <string name="permdesc_enableCarMode" msgid="4853187425751419467">"Permite que la aplicación habilite el modo automóvil."</string>
<string name="permlab_killBackgroundProcesses" msgid="3914026687420177202">"cerrar otras aplicaciones"</string>
<string name="permdesc_killBackgroundProcesses" msgid="4593353235959733119">"Este permiso autoriza a la aplicación a interrumpir procesos en segundo plano de otras aplicaciones y puede hacer, por lo tanto, que esas aplicaciones dejen de ejecutarse."</string>
<string name="permlab_forceStopPackages" msgid="2329627428832067700">"forzar la detención de otras aplicaciones"</string>
@@ -1195,7 +1195,7 @@
<string name="ime_action_search" msgid="658110271822807811">"Buscar"</string>
<string name="ime_action_send" msgid="2316166556349314424">"Enviar"</string>
<string name="ime_action_next" msgid="3138843904009813834">"Siguiente"</string>
- <string name="ime_action_done" msgid="8971516117910934605">"Hecho"</string>
+ <string name="ime_action_done" msgid="8971516117910934605">"Listo"</string>
<string name="ime_action_previous" msgid="1443550039250105948">"Ant."</string>
<string name="ime_action_default" msgid="2840921885558045721">"Ejecutar"</string>
<string name="dial_number_using" msgid="5789176425167573586">"Marcar el número"\n"con <xliff:g id="NUMBER">%s</xliff:g>"</string>
diff --git a/core/res/res/values-es/strings.xml b/core/res/res/values-es/strings.xml
index adb40a8..c72802b 100644
--- a/core/res/res/values-es/strings.xml
+++ b/core/res/res/values-es/strings.xml
@@ -155,7 +155,7 @@
<string name="global_action_lock" msgid="2844945191792119712">"Bloqueo de pantalla"</string>
<string name="global_action_power_off" msgid="4471879440839879722">"Apagar"</string>
<string name="global_action_bug_report" msgid="7934010578922304799">"Informe de error"</string>
- <string name="bugreport_title" msgid="2667494803742548533">"Hacer informe de errores"</string>
+ <string name="bugreport_title" msgid="2667494803742548533">"Crear informe de errores"</string>
<string name="bugreport_message" msgid="398447048750350456">"Se recopilará información sobre el estado actual de tu dispositivo, que se enviará por correo electrónico. Pasarán unos minutos desde que se inicie el informe de errores hasta que se envíe, por lo que te recomendamos que tengas paciencia."</string>
<string name="global_action_toggle_silent_mode" msgid="8219525344246810925">"Modo silencio"</string>
<string name="global_action_silent_mode_on_status" msgid="3289841937003758806">"El sonido está desactivado. Activar"</string>
@@ -1227,7 +1227,7 @@
<string name="car_mode_disable_notification_title" msgid="3164768212003864316">"Se ha habilitado el modo coche."</string>
<string name="car_mode_disable_notification_message" msgid="8035230537563503262">"Toca para salir del modo coche."</string>
<string name="tethered_notification_title" msgid="3146694234398202601">"Anclaje a red/Zona Wi-Fi activo"</string>
- <string name="tethered_notification_message" msgid="6857031760103062982">"Toca para configurar."</string>
+ <string name="tethered_notification_message" msgid="6857031760103062982">"Toca para configurar"</string>
<string name="back_button_label" msgid="2300470004503343439">"Atrás"</string>
<string name="next_button_label" msgid="1080555104677992408">"Siguiente"</string>
<string name="skip_button_label" msgid="1275362299471631819">"Saltar"</string>
@@ -1270,7 +1270,7 @@
<string name="sync_really_delete" msgid="2572600103122596243">"Eliminar elementos"</string>
<string name="sync_undo_deletes" msgid="2941317360600338602">"Deshacer las eliminaciones"</string>
<string name="sync_do_nothing" msgid="3743764740430821845">"No hacer nada por ahora"</string>
- <string name="choose_account_label" msgid="5655203089746423927">"Seleccionar una cuenta"</string>
+ <string name="choose_account_label" msgid="5655203089746423927">"Selecciona una cuenta"</string>
<string name="add_account_label" msgid="2935267344849993553">"Añadir una cuenta"</string>
<string name="add_account_button_label" msgid="3611982894853435874">"Añadir cuenta"</string>
<string name="number_picker_increment_button" msgid="2412072272832284313">"Aumentar"</string>
@@ -1372,11 +1372,11 @@
<string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
<string name="kg_emergency_call_label" msgid="684946192523830531">"Llamada de emergencia"</string>
<string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"¿Has olvidado el patrón?"</string>
- <string name="kg_wrong_pattern" msgid="1850806070801358830">"Patrón incorrecto"</string>
+ <string name="kg_wrong_pattern" msgid="1850806070801358830">"El patrón es incorrecto."</string>
<string name="kg_wrong_password" msgid="2333281762128113157">"Contraseña incorrecta"</string>
<string name="kg_wrong_pin" msgid="1131306510833563801">"PIN incorrecto"</string>
<string name="kg_too_many_failed_attempts_countdown" msgid="6358110221603297548">"Inténtalo de nuevo en <xliff:g id="NUMBER">%d</xliff:g> segundos."</string>
- <string name="kg_pattern_instructions" msgid="398978611683075868">"Dibuja tu patrón."</string>
+ <string name="kg_pattern_instructions" msgid="398978611683075868">"Dibuja tu patrón de desbloqueo."</string>
<string name="kg_sim_pin_instructions" msgid="2319508550934557331">"Introduce el PIN de la tarjeta SIM."</string>
<string name="kg_pin_instructions" msgid="2377242233495111557">"Introduce el PIN."</string>
<string name="kg_password_instructions" msgid="5753646556186936819">"Escribe tu contraseña."</string>
diff --git a/core/res/res/values-fr/strings.xml b/core/res/res/values-fr/strings.xml
index a824281..d076675 100644
--- a/core/res/res/values-fr/strings.xml
+++ b/core/res/res/values-fr/strings.xml
@@ -320,7 +320,7 @@
<string name="permlab_internalSystemWindow" msgid="2148563628140193231">"Affichage de fenêtres non autorisées"</string>
<string name="permdesc_internalSystemWindow" msgid="7458387759461466397">"Permet à l\'application de créer des fenêtres destinées à être utilisées par l\'interface utilisateur du système interne. Les applications standards ne doivent pas utiliser cette fonctionnalité."</string>
<string name="permlab_systemAlertWindow" msgid="3543347980839518613">"ignorer les autres applications"</string>
- <string name="permdesc_systemAlertWindow" msgid="8584678381972820118">"Permet à l\'application d\'afficher des graphismes dans d\'autres applications ou sur certaines parties de l\'interface utilisateur. Ceux-ci peuvent interférer lorsque vous utilisez l\'interface de n\'importe quelle application, ou modifier ce que vous pensez voir dans d\'autres applications."</string>
+ <string name="permdesc_systemAlertWindow" msgid="8584678381972820118">"Permet à l\'application d\'ignorer d\'autres applications ou certaines parties de l\'interface utilisateur. Cela peut altérer votre utilisation de l\'interface de n\'importe quelle application, ou modifier ce que vous pensez voir dans d\'autres applications."</string>
<string name="permlab_setAnimationScale" msgid="2805103241153907174">"Réglage de la vitesse des animations"</string>
<string name="permdesc_setAnimationScale" msgid="7690063428924343571">"Permet à l\'application de modifier à tout moment la vitesse générale des animations pour les ralentir ou les accélérer."</string>
<string name="permlab_manageAppTokens" msgid="1286505717050121370">"gérer les jetons d\'application"</string>
@@ -431,7 +431,7 @@
<string name="permlab_installLocationProvider" msgid="6578101199825193873">"autoriser l\'installation d\'un fournisseur de services de localisation"</string>
<string name="permdesc_installLocationProvider" msgid="9066146120470591509">"Permet de créer des sources de localisation fictives à des fins de tests ou pour installer un nouveau fournisseur de position. L\'application peut ainsi modifier la position et/ou l\'état renvoyé par d\'autres sources de localisation telles que le GPS ou les fournisseurs de position."</string>
<string name="permlab_accessFineLocation" msgid="1191898061965273372">"position précise (GPS et réseau)"</string>
- <string name="permdesc_accessFineLocation" msgid="5295047563564981250">"Permet à l\'application d\'obtenir votre position exacte à l\'aide du récepteur satellite GPS (Global Positioning System) ou des sources de localisation de réseau tels que les points d\'accès Wi-Fi et les antennes-relais. Ces services de localisation doivent être activés et disponibles sur votre appareil pour que l\'application puissent déterminer où vous vous trouvez, le cas échéant. Cette autorisation peut entraîner une utilisation accrue de la batterie."</string>
+ <string name="permdesc_accessFineLocation" msgid="5295047563564981250">"Permet à l\'application d\'obtenir votre position exacte à l\'aide du récepteur satellite GPS ou des sources de localisation de réseau tels que les points d\'accès Wi-Fi et les antennes-relais. Ces services de localisation doivent être activés et disponibles sur votre appareil pour que l\'application puissent déterminer où vous vous trouvez, le cas échéant. Cette autorisation peut entraîner une utilisation accrue de la batterie."</string>
<string name="permlab_accessCoarseLocation" msgid="4887895362354239628">"position approximative (réseau)"</string>
<string name="permdesc_accessCoarseLocation" msgid="2538200184373302295">"Permet à l\'application d\'obtenir votre position approximative. Celle-ci est fournie par des services de localisation sur la base des sources de localisation de réseau tels que les points d\'accès Wi-Fi et les antennes-relais. Ces services de localisation doivent être activés et disponibles sur votre appareil pour que l\'application puisse déterminer où vous vous trouvez de façon approximative, le cas échéant."</string>
<string name="permlab_accessSurfaceFlinger" msgid="2363969641792388947">"Accès à SurfaceFlinger"</string>
diff --git a/core/res/res/values-in/strings.xml b/core/res/res/values-in/strings.xml
index 7204b04..5c847e8 100644
--- a/core/res/res/values-in/strings.xml
+++ b/core/res/res/values-in/strings.xml
@@ -623,7 +623,7 @@
<string name="policydesc_encryptedStorage" msgid="2637732115325316992">"Mengharuskan data apl yang disimpan untuk dienkripsi."</string>
<string name="policylab_disableCamera" msgid="6395301023152297826">"Nonaktifkan kamera"</string>
<string name="policydesc_disableCamera" msgid="2306349042834754597">"Mencegah penggunaan semua kamera perangkat."</string>
- <string name="policylab_disableKeyguardFeatures" msgid="266329104542638802">"Menonaktifkan ftur di pengaman"</string>
+ <string name="policylab_disableKeyguardFeatures" msgid="266329104542638802">"Nonaktifkan fitur di pengaman"</string>
<string name="policydesc_disableKeyguardFeatures" msgid="3467082272186534614">"Mencegah penggunaan beberapa fitur dalam pengaman."</string>
<string-array name="phoneTypes">
<item msgid="8901098336658710359">"Rumah"</item>
diff --git a/core/res/res/values-ja/strings.xml b/core/res/res/values-ja/strings.xml
index 190eb97..6e85e9a 100644
--- a/core/res/res/values-ja/strings.xml
+++ b/core/res/res/values-ja/strings.xml
@@ -748,7 +748,7 @@
<string name="keyguard_password_wrong_pin_code" msgid="2422225591006134936">"PINコードが正しくありません。"</string>
<string name="keyguard_label_text" msgid="861796461028298424">"MENU、0キーでロック解除"</string>
<string name="emergency_call_dialog_number_for_display" msgid="696192103195090970">"緊急通報番号"</string>
- <string name="lockscreen_carrier_default" msgid="8963839242565653192">"通信サービスはありません。"</string>
+ <string name="lockscreen_carrier_default" msgid="8963839242565653192">"通信サービスはありません"</string>
<string name="lockscreen_screen_locked" msgid="7288443074806832904">"画面ロック中"</string>
<string name="lockscreen_instructions_when_pattern_enabled" msgid="46154051614126049">"MENUキーでロック解除(または緊急通報)"</string>
<string name="lockscreen_instructions_when_pattern_disabled" msgid="686260028797158364">"MENUキーでロック解除"</string>
@@ -1072,8 +1072,7 @@
<item quantity="other" msgid="7915895323644292768">"Wi-Fiオープンネットワークが利用できます"</item>
</plurals>
<string name="wifi_available_sign_in" msgid="4029489716605255386">"Wi-Fiネットワークにログイン"</string>
- <!-- no translation found for network_available_sign_in (8495155593358054676) -->
- <skip />
+ <string name="network_available_sign_in" msgid="8495155593358054676">"ネットワークにログイン"</string>
<!-- no translation found for network_available_sign_in_detailed (8000081941447976118) -->
<skip />
<string name="wifi_watchdog_network_disabled" msgid="7904214231651546347">"Wi-Fiに接続できませんでした"</string>
@@ -1091,8 +1090,7 @@
<string name="wifi_p2p_to_message" msgid="248968974522044099">"To:"</string>
<string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"必要なPINを入力してください:"</string>
<string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
- <!-- no translation found for wifi_p2p_frequency_conflict_message (7363907213787469151) -->
- <skip />
+ <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"携帯端末が<xliff:g id="DEVICE_NAME">%1$s</xliff:g>に接続されている間は一時的にWi-Fi接続が解除されます。"</string>
<string name="select_character" msgid="3365550120617701745">"文字を挿入"</string>
<string name="sms_control_title" msgid="7296612781128917719">"SMSメッセージの送信中"</string>
<string name="sms_control_message" msgid="3867899169651496433">"<b><xliff:g id="APP_NAME">%1$s</xliff:g></b>が大量のSMSメッセージを送信しています。このアプリにこのままメッセージの送信を許可しますか?"</string>
diff --git a/core/res/res/values-ko/strings.xml b/core/res/res/values-ko/strings.xml
index e91bda5..1e520bc 100644
--- a/core/res/res/values-ko/strings.xml
+++ b/core/res/res/values-ko/strings.xml
@@ -608,7 +608,7 @@
<string name="policylab_watchLogin" msgid="914130646942199503">"화면 잠금해제 시도 모니터링"</string>
<string name="policydesc_watchLogin" product="tablet" msgid="3215729294215070072">"화면 잠금해제 시 비밀번호를 잘못 입력한 횟수를 모니터링하고, 잘못된 비밀번호 입력 횟수가 너무 많은 경우 태블릿을 잠그거나 태블릿에 있는 데이터를 모두 지웁니다."</string>
<string name="policydesc_watchLogin" product="default" msgid="5712323091846761073">"화면 잠금해제 시 비밀번호를 잘못 입력한 횟수를 모니터링하고, 잘못된 비밀번호 입력 횟수가 너무 많은 경우 휴대전화를 잠그거나 휴대전화에 있는 데이터를 모두 지웁니다."</string>
- <string name="policylab_resetPassword" msgid="2620077191242688955">"화면 잠금해제 비밀번호를 변경합니다."</string>
+ <string name="policylab_resetPassword" msgid="2620077191242688955">"화면 잠금해제 비밀번호 변경"</string>
<string name="policydesc_resetPassword" msgid="605963962301904458">"화면 잠금해제 비밀번호를 변경합니다."</string>
<string name="policylab_forceLock" msgid="2274085384704248431">"화면 잠금"</string>
<string name="policydesc_forceLock" msgid="1141797588403827138">"화면을 잠그는 방법과 시기를 제어합니다."</string>
diff --git a/core/res/res/values-pt/strings.xml b/core/res/res/values-pt/strings.xml
index cade007..7931ab9 100644
--- a/core/res/res/values-pt/strings.xml
+++ b/core/res/res/values-pt/strings.xml
@@ -1072,8 +1072,7 @@
<item quantity="other" msgid="7915895323644292768">"Redes Wi-Fi abertas disponíveis"</item>
</plurals>
<string name="wifi_available_sign_in" msgid="4029489716605255386">"Fazer login na rede Wi-Fi"</string>
- <!-- no translation found for network_available_sign_in (8495155593358054676) -->
- <skip />
+ <string name="network_available_sign_in" msgid="8495155593358054676">"Acessar a rede"</string>
<!-- no translation found for network_available_sign_in_detailed (8000081941447976118) -->
<skip />
<string name="wifi_watchdog_network_disabled" msgid="7904214231651546347">"Não foi possível se conectar a redes Wi-Fi"</string>
@@ -1091,8 +1090,7 @@
<string name="wifi_p2p_to_message" msgid="248968974522044099">"Para:"</string>
<string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Digite o PIN obrigatório:"</string>
<string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
- <!-- no translation found for wifi_p2p_frequency_conflict_message (7363907213787469151) -->
- <skip />
+ <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"O telefone desconectará temporariamente da rede Wi-Fi enquanto estiver conectado a <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
<string name="select_character" msgid="3365550120617701745">"Inserir caractere"</string>
<string name="sms_control_title" msgid="7296612781128917719">"Enviando mensagens SMS"</string>
<string name="sms_control_message" msgid="3867899169651496433">"<b><xliff:g id="APP_NAME">%1$s</xliff:g></b> envia uma grande quantidade de mensagens SMS. Deseja permitir que este aplicativo continue enviando mensagens?"</string>
diff --git a/core/res/res/values-ro/strings.xml b/core/res/res/values-ro/strings.xml
index 81c304e..c355b0c 100644
--- a/core/res/res/values-ro/strings.xml
+++ b/core/res/res/values-ro/strings.xml
@@ -1072,8 +1072,7 @@
<item quantity="other" msgid="7915895323644292768">"Reţele Wi-Fi deschise disponibile"</item>
</plurals>
<string name="wifi_available_sign_in" msgid="4029489716605255386">"Conectaţi-vă în reţeaua Wi-Fi"</string>
- <!-- no translation found for network_available_sign_in (8495155593358054676) -->
- <skip />
+ <string name="network_available_sign_in" msgid="8495155593358054676">"Conectaţi-vă la reţea"</string>
<!-- no translation found for network_available_sign_in_detailed (8000081941447976118) -->
<skip />
<string name="wifi_watchdog_network_disabled" msgid="7904214231651546347">"Nu se poate conecta la Wi-Fi"</string>
@@ -1091,8 +1090,7 @@
<string name="wifi_p2p_to_message" msgid="248968974522044099">"Către:"</string>
<string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Introduceţi codul PIN necesar:"</string>
<string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"Cod PIN:"</string>
- <!-- no translation found for wifi_p2p_frequency_conflict_message (7363907213787469151) -->
- <skip />
+ <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Telefonul se va deconecta temporar de la reţeaua Wi-Fi cât timp este conectat la <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
<string name="select_character" msgid="3365550120617701745">"Introduceţi caracterul"</string>
<string name="sms_control_title" msgid="7296612781128917719">"Se trimit mesaje SMS"</string>
<string name="sms_control_message" msgid="3867899169651496433">"<b><xliff:g id="APP_NAME">%1$s</xliff:g></b> trimite un număr mare de mesaje SMS. Permiteţi acestei aplicaţii să trimită în continuare mesaje?"</string>
diff --git a/core/res/res/values-ru/strings.xml b/core/res/res/values-ru/strings.xml
index b26880b..b031de3 100644
--- a/core/res/res/values-ru/strings.xml
+++ b/core/res/res/values-ru/strings.xml
@@ -1258,8 +1258,8 @@
<string name="share" msgid="1778686618230011964">"Отправить"</string>
<string name="find" msgid="4808270900322985960">"Найти"</string>
<string name="websearch" msgid="4337157977400211589">"Веб-поиск"</string>
- <string name="find_next" msgid="5742124618942193978">"Найти след."</string>
- <string name="find_previous" msgid="2196723669388360506">"Найти пред."</string>
+ <string name="find_next" msgid="5742124618942193978">"Cлед."</string>
+ <string name="find_previous" msgid="2196723669388360506">"Пред."</string>
<string name="gpsNotifTicker" msgid="5622683912616496172">"Пользователь <xliff:g id="NAME">%s</xliff:g> запрашивает ваше местоположение"</string>
<string name="gpsNotifTitle" msgid="5446858717157416839">"Запрос местоположения"</string>
<string name="gpsNotifMessage" msgid="1374718023224000702">"Запрашивает <xliff:g id="NAME">%1$s</xliff:g> (<xliff:g id="SERVICE">%2$s</xliff:g>)"</string>
diff --git a/core/res/res/values-sk/strings.xml b/core/res/res/values-sk/strings.xml
index 4d8cc6d..118867b 100644
--- a/core/res/res/values-sk/strings.xml
+++ b/core/res/res/values-sk/strings.xml
@@ -623,7 +623,7 @@
<string name="policydesc_encryptedStorage" msgid="2637732115325316992">"Vyžadovať šifrovanie uložených údajov aplikácií."</string>
<string name="policylab_disableCamera" msgid="6395301023152297826">"Zakázať fotoaparáty"</string>
<string name="policydesc_disableCamera" msgid="2306349042834754597">"Zakázať používanie všetkých fotoaparátov zariadenia."</string>
- <string name="policylab_disableKeyguardFeatures" msgid="266329104542638802">"Zakáz. funkcie v zámke kláves."</string>
+ <string name="policylab_disableKeyguardFeatures" msgid="266329104542638802">"Zákaz funkcie v zámke kláves."</string>
<string name="policydesc_disableKeyguardFeatures" msgid="3467082272186534614">"Zabrániť používaniu niektorých funkcií v zámke klávesov."</string>
<string-array name="phoneTypes">
<item msgid="8901098336658710359">"Domovská stránka"</item>
@@ -1072,8 +1072,7 @@
<item quantity="other" msgid="7915895323644292768">"K dispozícii sú verejné siete Wi-Fi"</item>
</plurals>
<string name="wifi_available_sign_in" msgid="4029489716605255386">"Prihlásenie sa do siete Wi-Fi"</string>
- <!-- no translation found for network_available_sign_in (8495155593358054676) -->
- <skip />
+ <string name="network_available_sign_in" msgid="8495155593358054676">"Prihláste sa do siete"</string>
<!-- no translation found for network_available_sign_in_detailed (8000081941447976118) -->
<skip />
<string name="wifi_watchdog_network_disabled" msgid="7904214231651546347">"Nepodarilo sa pripojiť k sieti Wi-Fi"</string>
@@ -1091,8 +1090,7 @@
<string name="wifi_p2p_to_message" msgid="248968974522044099">"Komu:"</string>
<string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Zadajte požadovaný kód PIN:"</string>
<string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
- <!-- no translation found for wifi_p2p_frequency_conflict_message (7363907213787469151) -->
- <skip />
+ <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Telefón bude počas pripojenia k zariadeniu <xliff:g id="DEVICE_NAME">%1$s</xliff:g> od siete Wi-Fi dočasne odpojený."</string>
<string name="select_character" msgid="3365550120617701745">"Vkladanie znakov"</string>
<string name="sms_control_title" msgid="7296612781128917719">"Odosielanie správ SMS"</string>
<string name="sms_control_message" msgid="3867899169651496433">"Aplikácia <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> posiela veľký počet správ SMS. Chcete tejto aplikácií povoliť, aby aj naďalej posielala správy?"</string>
diff --git a/core/res/res/values-sw600dp/bools.xml b/core/res/res/values-sw600dp/bools.xml
index b8db31f..751b997 100644
--- a/core/res/res/values-sw600dp/bools.xml
+++ b/core/res/res/values-sw600dp/bools.xml
@@ -16,4 +16,5 @@
<resources>
<bool name="target_honeycomb_needs_options_menu">false</bool>
+ <bool name="show_ongoing_ime_switcher">false</bool>
</resources>
diff --git a/core/res/res/values-tr/strings.xml b/core/res/res/values-tr/strings.xml
index 09a1805..b34dbbd 100644
--- a/core/res/res/values-tr/strings.xml
+++ b/core/res/res/values-tr/strings.xml
@@ -1072,8 +1072,7 @@
<item quantity="other" msgid="7915895323644292768">"Kullanılabilir kablosuz ağları aç"</item>
</plurals>
<string name="wifi_available_sign_in" msgid="4029489716605255386">"Kablosuz ağda oturum açın"</string>
- <!-- no translation found for network_available_sign_in (8495155593358054676) -->
- <skip />
+ <string name="network_available_sign_in" msgid="8495155593358054676">"Ağda oturum açın"</string>
<!-- no translation found for network_available_sign_in_detailed (8000081941447976118) -->
<skip />
<string name="wifi_watchdog_network_disabled" msgid="7904214231651546347">"Kablosuz bağlantısı kurulamadı"</string>
@@ -1091,8 +1090,7 @@
<string name="wifi_p2p_to_message" msgid="248968974522044099">"Alıcı:"</string>
<string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Gerekli PIN\'i yazın:"</string>
<string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
- <!-- no translation found for wifi_p2p_frequency_conflict_message (7363907213787469151) -->
- <skip />
+ <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Telefon <xliff:g id="DEVICE_NAME">%1$s</xliff:g> adlı cihaza bağlıyken Kablosuz ağ bağlantısı geçici olarak kesilecektir"</string>
<string name="select_character" msgid="3365550120617701745">"Karakter ekle"</string>
<string name="sms_control_title" msgid="7296612781128917719">"SMS mesajları gönderiliyor"</string>
<string name="sms_control_message" msgid="3867899169651496433">"<b><xliff:g id="APP_NAME">%1$s</xliff:g></b> çok sayıda SMS mesajı gönderiyor. Bu uygulamanın mesaj göndermeye devam etmesine izin veriyor musunuz?"</string>
diff --git a/core/res/res/values-vi/strings.xml b/core/res/res/values-vi/strings.xml
index 8ab2674..dfb484d 100644
--- a/core/res/res/values-vi/strings.xml
+++ b/core/res/res/values-vi/strings.xml
@@ -1259,7 +1259,7 @@
<string name="find" msgid="4808270900322985960">"Tìm"</string>
<string name="websearch" msgid="4337157977400211589">"Tìm kiếm trên web"</string>
<string name="find_next" msgid="5742124618942193978">"Tìm kết quả phù hợp tiếp theo"</string>
- <string name="find_previous" msgid="2196723669388360506">"Tìm kết quả phù hợp trước đó"</string>
+ <string name="find_previous" msgid="2196723669388360506">"Tìm kết quả phù hợp trước"</string>
<string name="gpsNotifTicker" msgid="5622683912616496172">"Yêu cầu vị trí từ <xliff:g id="NAME">%s</xliff:g>"</string>
<string name="gpsNotifTitle" msgid="5446858717157416839">"Yêu cầu vị trí"</string>
<string name="gpsNotifMessage" msgid="1374718023224000702">"Được yêu cầu bởi <xliff:g id="NAME">%1$s</xliff:g> (<xliff:g id="SERVICE">%2$s</xliff:g>)"</string>
diff --git a/core/res/res/values-w720dp/bools.xml b/core/res/res/values-w720dp/bools.xml
index cd595ad..352c319 100644
--- a/core/res/res/values-w720dp/bools.xml
+++ b/core/res/res/values-w720dp/bools.xml
@@ -16,5 +16,4 @@
<resources>
<bool name="action_bar_expanded_action_views_exclusive">false</bool>
- <bool name="show_ongoing_ime_switcher">true</bool>
</resources>
diff --git a/core/res/res/values-zu/strings.xml b/core/res/res/values-zu/strings.xml
index 249df57..bea960a 100644
--- a/core/res/res/values-zu/strings.xml
+++ b/core/res/res/values-zu/strings.xml
@@ -1072,8 +1072,7 @@
<item quantity="other" msgid="7915895323644292768">"Vula amanethiwekhi we-Wi-Fi atholakalayo"</item>
</plurals>
<string name="wifi_available_sign_in" msgid="4029489716605255386">"Ngena enethiwekhini ye-Wi-Fi network"</string>
- <!-- no translation found for network_available_sign_in (8495155593358054676) -->
- <skip />
+ <string name="network_available_sign_in" msgid="8495155593358054676">"Ngena ngemvume kunethiwekhi"</string>
<!-- no translation found for network_available_sign_in_detailed (8000081941447976118) -->
<skip />
<string name="wifi_watchdog_network_disabled" msgid="7904214231651546347">"Ayikwazanga ukuxhuma kwi-Wi-Fi"</string>
@@ -1091,8 +1090,7 @@
<string name="wifi_p2p_to_message" msgid="248968974522044099">"Ku:"</string>
<string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Faka i-PIN edingekayo:"</string>
<string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
- <!-- no translation found for wifi_p2p_frequency_conflict_message (7363907213787469151) -->
- <skip />
+ <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Ifoni izonqamuka okwesikhashana ku-Wi-Fi ngenkathi ixhumeke ku-<xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
<string name="select_character" msgid="3365550120617701745">"Faka uhlamvu"</string>
<string name="sms_control_title" msgid="7296612781128917719">"Ithumela imiyalezo ye-SMS"</string>
<string name="sms_control_message" msgid="3867899169651496433">"I-<b><xliff:g id="APP_NAME">%1$s</xliff:g></b> ithumela inombolo enkulu yemilayezo ye-SMS. Ufuna ukuvumela lolu hlelo lokusebenza ukuqhubeka ukuthumela imilayezo?"</string>
diff --git a/graphics/java/android/renderscript/ScriptIntrinsicBlend.java b/graphics/java/android/renderscript/ScriptIntrinsicBlend.java
index 13c03af..65c69c0 100644
--- a/graphics/java/android/renderscript/ScriptIntrinsicBlend.java
+++ b/graphics/java/android/renderscript/ScriptIntrinsicBlend.java
@@ -36,17 +36,18 @@
* @return ScriptIntrinsicBlend
*/
public static ScriptIntrinsicBlend create(RenderScript rs, Element e) {
- int id = rs.nScriptIntrinsicCreate(6, e.getID(rs));
+ // 7 comes from RS_SCRIPT_INTRINSIC_ID_BLEND in rsDefines.h
+ int id = rs.nScriptIntrinsicCreate(7, e.getID(rs));
return new ScriptIntrinsicBlend(id, rs);
}
private void blend(int id, Allocation ain, Allocation aout) {
- if (ain.getElement() != Element.U8_4(mRS)) {
- throw new RSIllegalArgumentException("Input not of expected format.");
+ if (!ain.getElement().isCompatible(Element.U8_4(mRS))) {
+ throw new RSIllegalArgumentException("Input is not of expected format.");
}
- if (aout.getElement() != Element.U8_4(mRS)) {
- throw new RSIllegalArgumentException("Output not of expected format.");
+ if (!aout.getElement().isCompatible(Element.U8_4(mRS))) {
+ throw new RSIllegalArgumentException("Output is not of expected format.");
}
forEach(id, ain, aout, null);
}
diff --git a/libs/hwui/Program.cpp b/libs/hwui/Program.cpp
index 5b1b57d..f0b5553 100644
--- a/libs/hwui/Program.cpp
+++ b/libs/hwui/Program.cpp
@@ -81,6 +81,7 @@
if (mInitialized) {
transform = addUniform("transform");
+ projection = addUniform("projection");
}
}
@@ -152,18 +153,20 @@
void Program::set(const mat4& projectionMatrix, const mat4& modelViewMatrix,
const mat4& transformMatrix, bool offset) {
- mat4 t(projectionMatrix);
+ mat4 p(projectionMatrix);
if (offset) {
// offset screenspace xy by an amount that compensates for typical precision
// issues in GPU hardware that tends to paint hor/vert lines in pixels shifted
// up and to the left.
// This offset value is based on an assumption that some hardware may use as
// little as 12.4 precision, so we offset by slightly more than 1/16.
- t.translate(.375, .375, 0);
+ p.translate(.375, .375, 0);
}
- t.multiply(transformMatrix);
+
+ mat4 t(transformMatrix);
t.multiply(modelViewMatrix);
+ glUniformMatrix4fv(projection, 1, GL_FALSE, &p.data[0]);
glUniformMatrix4fv(transform, 1, GL_FALSE, &t.data[0]);
}
diff --git a/libs/hwui/Program.h b/libs/hwui/Program.h
index b1cb446..7e3aacf 100644
--- a/libs/hwui/Program.h
+++ b/libs/hwui/Program.h
@@ -374,6 +374,11 @@
*/
int transform;
+ /**
+ * Name of the projection uniform.
+ */
+ int projection;
+
protected:
/**
* Adds an attribute with the specified name.
diff --git a/libs/hwui/ProgramCache.cpp b/libs/hwui/ProgramCache.cpp
index 7bc2b37..f536ade 100644
--- a/libs/hwui/ProgramCache.cpp
+++ b/libs/hwui/ProgramCache.cpp
@@ -48,6 +48,7 @@
const char* gVS_Header_Uniforms_TextureTransform =
"uniform mat4 mainTextureTransform;\n";
const char* gVS_Header_Uniforms =
+ "uniform mat4 projection;\n" \
"uniform mat4 transform;\n";
const char* gVS_Header_Uniforms_IsPoint =
"uniform mediump float pointSize;\n";
@@ -104,28 +105,28 @@
const char* gVS_Main_OutGradient[6] = {
// Linear
" linear = vec2((screenSpace * position).x, 0.5);\n"
- " ditherTexCoords = (gl_Position * ditherSize).xy;\n",
+ " ditherTexCoords = (transform * position).xy * ditherSize;\n",
" linear = (screenSpace * position).x;\n"
- " ditherTexCoords = (gl_Position * ditherSize).xy;\n",
+ " ditherTexCoords = (transform * position).xy * ditherSize;\n",
// Circular
" circular = (screenSpace * position).xy;\n"
- " ditherTexCoords = (gl_Position * ditherSize).xy;\n",
+ " ditherTexCoords = (transform * position).xy * ditherSize;\n",
" circular = (screenSpace * position).xy;\n"
- " ditherTexCoords = (gl_Position * ditherSize).xy;\n",
+ " ditherTexCoords = (transform * position).xy * ditherSize;\n",
// Sweep
" sweep = (screenSpace * position).xy;\n"
- " ditherTexCoords = (gl_Position * ditherSize).xy;\n",
+ " ditherTexCoords = (transform * position).xy * ditherSize;\n",
" sweep = (screenSpace * position).xy;\n"
- " ditherTexCoords = (gl_Position * ditherSize).xy;\n",
+ " ditherTexCoords = (transform * position).xy * ditherSize;\n",
};
const char* gVS_Main_OutBitmapTexCoords =
" outBitmapTexCoords = (textureTransform * position).xy * textureDimension;\n";
const char* gVS_Main_OutPointBitmapTexCoords =
" outPointBitmapTexCoords = (textureTransform * position).xy * textureDimension;\n";
const char* gVS_Main_Position =
- " gl_Position = transform * position;\n";
+ " gl_Position = projection * transform * position;\n";
const char* gVS_Main_PointSize =
" gl_PointSize = pointSize;\n";
const char* gVS_Main_AALine =
diff --git a/location/java/android/location/Location.java b/location/java/android/location/Location.java
index 672e378..f057ebc 100644
--- a/location/java/android/location/Location.java
+++ b/location/java/android/location/Location.java
@@ -71,7 +71,7 @@
private String mProvider;
private long mTime = 0;
- private long mElapsedRealtimeNano = 0;
+ private long mElapsedRealtimeNanos = 0;
private double mLatitude = 0.0;
private double mLongitude = 0.0;
private boolean mHasAltitude = false;
@@ -120,7 +120,7 @@
public void set(Location l) {
mProvider = l.mProvider;
mTime = l.mTime;
- mElapsedRealtimeNano = l.mElapsedRealtimeNano;
+ mElapsedRealtimeNanos = l.mElapsedRealtimeNanos;
mLatitude = l.mLatitude;
mLongitude = l.mLongitude;
mHasAltitude = l.mHasAltitude;
@@ -140,7 +140,7 @@
public void reset() {
mProvider = null;
mTime = 0;
- mElapsedRealtimeNano = 0;
+ mElapsedRealtimeNanos = 0;
mLatitude = 0;
mLongitude = 0;
mHasAltitude = false;
@@ -485,7 +485,7 @@
*
* <p>Note that the UTC time on a device is not monotonic: it
* can jump forwards or backwards unpredictably. So always use
- * {@link #getElapsedRealtimeNano} when calculating time deltas.
+ * {@link #getElapsedRealtimeNanos} when calculating time deltas.
*
* <p>On the other hand, {@link #getTime} is useful for presenting
* a human readable time to the user, or for carefully comparing
@@ -515,7 +515,7 @@
* Return the time of this fix, in elapsed real-time since system boot.
*
* <p>This value can be reliably compared to
- * {@link android.os.SystemClock#elapsedRealtimeNano},
+ * {@link android.os.SystemClock#elapsedRealtimeNanos},
* to calculate the age of a fix and to compare Location fixes. This
* is reliable because elapsed real-time is guaranteed monotonic for
* each system boot and continues to increment even when the system
@@ -526,8 +526,8 @@
*
* @return elapsed real-time of fix, in nanoseconds since system boot.
*/
- public long getElapsedRealtimeNano() {
- return mElapsedRealtimeNano;
+ public long getElapsedRealtimeNanos() {
+ return mElapsedRealtimeNanos;
}
/**
@@ -535,8 +535,8 @@
*
* @param time elapsed real-time of fix, in nanoseconds since system boot.
*/
- public void setElapsedRealtimeNano(long time) {
- mElapsedRealtimeNano = time;
+ public void setElapsedRealtimeNanos(long time) {
+ mElapsedRealtimeNanos = time;
}
/**
@@ -772,7 +772,7 @@
if (mProvider == null) return false;
if (!mHasAccuracy) return false;
if (mTime == 0) return false;
- if (mElapsedRealtimeNano == 0) return false;
+ if (mElapsedRealtimeNanos == 0) return false;
return true;
}
@@ -792,7 +792,7 @@
mAccuracy = 100.0f;
}
if (mTime == 0) mTime = System.currentTimeMillis();
- if (mElapsedRealtimeNano == 0) mElapsedRealtimeNano = SystemClock.elapsedRealtimeNano();
+ if (mElapsedRealtimeNanos == 0) mElapsedRealtimeNanos = SystemClock.elapsedRealtimeNanos();
}
/**
@@ -832,11 +832,11 @@
if (mTime == 0) {
s.append(" t=?!?");
}
- if (mElapsedRealtimeNano == 0) {
+ if (mElapsedRealtimeNanos == 0) {
s.append(" et=?!?");
} else {
s.append(" et=");
- TimeUtils.formatDuration(mElapsedRealtimeNano / 1000000L, s);
+ TimeUtils.formatDuration(mElapsedRealtimeNanos / 1000000L, s);
}
if (mHasAltitude) s.append(" alt=").append(mAltitude);
if (mHasSpeed) s.append(" vel=").append(mSpeed);
@@ -860,7 +860,7 @@
String provider = in.readString();
Location l = new Location(provider);
l.mTime = in.readLong();
- l.mElapsedRealtimeNano = in.readLong();
+ l.mElapsedRealtimeNanos = in.readLong();
l.mLatitude = in.readDouble();
l.mLongitude = in.readDouble();
l.mHasAltitude = in.readInt() != 0;
@@ -890,7 +890,7 @@
public void writeToParcel(Parcel parcel, int flags) {
parcel.writeString(mProvider);
parcel.writeLong(mTime);
- parcel.writeLong(mElapsedRealtimeNano);
+ parcel.writeLong(mElapsedRealtimeNanos);
parcel.writeDouble(mLatitude);
parcel.writeDouble(mLongitude);
parcel.writeInt(mHasAltitude ? 1 : 0);
diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java
index 5b3c9e2..4ad8fd0 100644
--- a/location/java/android/location/LocationManager.java
+++ b/location/java/android/location/LocationManager.java
@@ -1186,7 +1186,7 @@
* Get the last known location.
*
* <p>This location could be very old so use
- * {@link Location#getElapsedRealtimeNano} to calculate its age. It can
+ * {@link Location#getElapsedRealtimeNanos} to calculate its age. It can
* also return null if no previous location is available.
*
* <p>Always returns immediately.
diff --git a/media/java/android/media/IRingtonePlayer.aidl b/media/java/android/media/IRingtonePlayer.aidl
index 44a0333..0872f1d 100644
--- a/media/java/android/media/IRingtonePlayer.aidl
+++ b/media/java/android/media/IRingtonePlayer.aidl
@@ -17,6 +17,7 @@
package android.media;
import android.net.Uri;
+import android.os.UserHandle;
/**
* @hide
@@ -28,6 +29,6 @@
boolean isPlaying(IBinder token);
/** Used for Notification sound playback. */
- void playAsync(in Uri uri, boolean looping, int streamType);
+ void playAsync(in Uri uri, in UserHandle user, boolean looping, int streamType);
void stopAsync();
}
diff --git a/media/java/android/media/Ringtone.java b/media/java/android/media/Ringtone.java
index 23f7b55..f190eb9 100644
--- a/media/java/android/media/Ringtone.java
+++ b/media/java/android/media/Ringtone.java
@@ -225,8 +225,9 @@
mLocalPlayer.start();
}
} else if (mAllowRemote) {
+ final Uri canonicalUri = mUri.getCanonicalUri();
try {
- mRemotePlayer.play(mRemoteToken, mUri, mStreamType);
+ mRemotePlayer.play(mRemoteToken, canonicalUri, mStreamType);
} catch (RemoteException e) {
Log.w(TAG, "Problem playing ringtone: " + e);
}
diff --git a/packages/FusedLocation/src/com/android/location/fused/FusionEngine.java b/packages/FusedLocation/src/com/android/location/fused/FusionEngine.java
index b83521ae..2cf795d 100644
--- a/packages/FusedLocation/src/com/android/location/fused/FusionEngine.java
+++ b/packages/FusedLocation/src/com/android/location/fused/FusionEngine.java
@@ -215,7 +215,7 @@
}
private static double weighAge(Location loc) {
- long ageSeconds = SystemClock.elapsedRealtimeNano() - loc.getElapsedRealtimeNano();
+ long ageSeconds = SystemClock.elapsedRealtimeNanos() - loc.getElapsedRealtimeNanos();
ageSeconds /= 1000000000L;
if (ageSeconds < 0) ageSeconds = 0;
return Math.exp(-ageSeconds * AGE_DECAY_CONSTANT_S);
@@ -266,7 +266,7 @@
// fused time - now
fused.setTime(System.currentTimeMillis());
- fused.setElapsedRealtimeNano(SystemClock.elapsedRealtimeNano());
+ fused.setElapsedRealtimeNanos(SystemClock.elapsedRealtimeNanos());
// fuse altitude
if (mGpsLocation.hasAltitude() && !mNetworkLocation.hasAltitude() &&
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
index 8275b25..dc4213e 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
@@ -472,7 +472,7 @@
String value =
mContext.getResources().getBoolean(R.bool.assisted_gps_enabled) ? "1" : "0";
db.execSQL("INSERT OR IGNORE INTO secure(name,value) values('" +
- Settings.Secure.ASSISTED_GPS_ENABLED + "','" + value + "');");
+ Settings.Global.ASSISTED_GPS_ENABLED + "','" + value + "');");
db.setTransactionSuccessful();
} finally {
db.endTransaction();
@@ -1190,7 +1190,7 @@
try {
stmt = db.compileStatement("INSERT OR REPLACE INTO secure(name,value)"
+ " VALUES(?,?);");
- loadBooleanSetting(stmt, Settings.Secure.PACKAGE_VERIFIER_ENABLE,
+ loadBooleanSetting(stmt, Settings.Global.PACKAGE_VERIFIER_ENABLE,
R.bool.def_package_verifier_enable);
db.setTransactionSuccessful();
} finally {
@@ -1300,9 +1300,9 @@
db.beginTransaction();
try {
String[] settingsToMove = {
- Settings.Secure.PACKAGE_VERIFIER_ENABLE,
- Settings.Secure.PACKAGE_VERIFIER_TIMEOUT,
- Settings.Secure.PACKAGE_VERIFIER_DEFAULT_RESPONSE
+ Settings.Global.PACKAGE_VERIFIER_ENABLE,
+ Settings.Global.PACKAGE_VERIFIER_TIMEOUT,
+ Settings.Global.PACKAGE_VERIFIER_DEFAULT_RESPONSE
};
moveSettingsToNewTable(db, TABLE_SECURE, TABLE_GLOBAL, settingsToMove, true);
@@ -1319,9 +1319,9 @@
db.beginTransaction();
try {
String[] settingsToMove = {
- Settings.Secure.DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS,
- Settings.Secure.DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS,
- Settings.Secure.GPRS_REGISTER_CHECK_PERIOD_MS
+ Settings.Global.DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS,
+ Settings.Global.DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS,
+ Settings.Global.GPRS_REGISTER_CHECK_PERIOD_MS
};
moveSettingsToNewTable(db, TABLE_SECURE, TABLE_GLOBAL, settingsToMove, true);
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index 6d8b08f..2c0bf75 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -110,94 +110,94 @@
// table, shared across all users
// These must match Settings.Secure.MOVED_TO_GLOBAL
sSecureGlobalKeys = new HashSet<String>();
- sSecureGlobalKeys.add(Settings.Secure.ADB_ENABLED);
- sSecureGlobalKeys.add(Settings.Secure.ASSISTED_GPS_ENABLED);
- sSecureGlobalKeys.add(Settings.Secure.BLUETOOTH_ON);
- sSecureGlobalKeys.add(Settings.Secure.CDMA_CELL_BROADCAST_SMS);
- sSecureGlobalKeys.add(Settings.Secure.CDMA_ROAMING_MODE);
- sSecureGlobalKeys.add(Settings.Secure.CDMA_SUBSCRIPTION_MODE);
- sSecureGlobalKeys.add(Settings.Secure.DATA_ACTIVITY_TIMEOUT_MOBILE);
- sSecureGlobalKeys.add(Settings.Secure.DATA_ACTIVITY_TIMEOUT_WIFI);
- sSecureGlobalKeys.add(Settings.Secure.DATA_ROAMING);
- sSecureGlobalKeys.add(Settings.Secure.DEVELOPMENT_SETTINGS_ENABLED);
- sSecureGlobalKeys.add(Settings.Secure.DEVICE_PROVISIONED);
- sSecureGlobalKeys.add(Settings.Secure.DISPLAY_DENSITY_FORCED);
- sSecureGlobalKeys.add(Settings.Secure.DISPLAY_SIZE_FORCED);
- sSecureGlobalKeys.add(Settings.Secure.DOWNLOAD_MAX_BYTES_OVER_MOBILE);
- sSecureGlobalKeys.add(Settings.Secure.DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE);
- sSecureGlobalKeys.add(Settings.Secure.INSTALL_NON_MARKET_APPS);
- sSecureGlobalKeys.add(Settings.Secure.MOBILE_DATA);
- sSecureGlobalKeys.add(Settings.Secure.NETSTATS_DEV_BUCKET_DURATION);
- sSecureGlobalKeys.add(Settings.Secure.NETSTATS_DEV_DELETE_AGE);
- sSecureGlobalKeys.add(Settings.Secure.NETSTATS_DEV_PERSIST_BYTES);
- sSecureGlobalKeys.add(Settings.Secure.NETSTATS_DEV_ROTATE_AGE);
- sSecureGlobalKeys.add(Settings.Secure.NETSTATS_ENABLED);
- sSecureGlobalKeys.add(Settings.Secure.NETSTATS_GLOBAL_ALERT_BYTES);
- sSecureGlobalKeys.add(Settings.Secure.NETSTATS_POLL_INTERVAL);
- sSecureGlobalKeys.add(Settings.Secure.NETSTATS_REPORT_XT_OVER_DEV);
- sSecureGlobalKeys.add(Settings.Secure.NETSTATS_SAMPLE_ENABLED);
- sSecureGlobalKeys.add(Settings.Secure.NETSTATS_TIME_CACHE_MAX_AGE);
- sSecureGlobalKeys.add(Settings.Secure.NETSTATS_UID_BUCKET_DURATION);
- sSecureGlobalKeys.add(Settings.Secure.NETSTATS_UID_DELETE_AGE);
- sSecureGlobalKeys.add(Settings.Secure.NETSTATS_UID_PERSIST_BYTES);
- sSecureGlobalKeys.add(Settings.Secure.NETSTATS_UID_ROTATE_AGE);
- sSecureGlobalKeys.add(Settings.Secure.NETSTATS_UID_TAG_BUCKET_DURATION);
- sSecureGlobalKeys.add(Settings.Secure.NETSTATS_UID_TAG_DELETE_AGE);
- sSecureGlobalKeys.add(Settings.Secure.NETSTATS_UID_TAG_PERSIST_BYTES);
- sSecureGlobalKeys.add(Settings.Secure.NETSTATS_UID_TAG_ROTATE_AGE);
- sSecureGlobalKeys.add(Settings.Secure.NETWORK_PREFERENCE);
- sSecureGlobalKeys.add(Settings.Secure.NITZ_UPDATE_DIFF);
- sSecureGlobalKeys.add(Settings.Secure.NITZ_UPDATE_SPACING);
- sSecureGlobalKeys.add(Settings.Secure.NTP_SERVER);
- sSecureGlobalKeys.add(Settings.Secure.NTP_TIMEOUT);
- sSecureGlobalKeys.add(Settings.Secure.PDP_WATCHDOG_ERROR_POLL_COUNT);
- sSecureGlobalKeys.add(Settings.Secure.PDP_WATCHDOG_LONG_POLL_INTERVAL_MS);
- sSecureGlobalKeys.add(Settings.Secure.PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT);
- sSecureGlobalKeys.add(Settings.Secure.PDP_WATCHDOG_POLL_INTERVAL_MS);
- sSecureGlobalKeys.add(Settings.Secure.PDP_WATCHDOG_TRIGGER_PACKET_COUNT);
- sSecureGlobalKeys.add(Settings.Secure.SAMPLING_PROFILER_MS);
- sSecureGlobalKeys.add(Settings.Secure.SETUP_PREPAID_DATA_SERVICE_URL);
- sSecureGlobalKeys.add(Settings.Secure.SETUP_PREPAID_DETECTION_REDIR_HOST);
- sSecureGlobalKeys.add(Settings.Secure.SETUP_PREPAID_DETECTION_TARGET_URL);
- sSecureGlobalKeys.add(Settings.Secure.TETHER_DUN_APN);
- sSecureGlobalKeys.add(Settings.Secure.TETHER_DUN_REQUIRED);
- sSecureGlobalKeys.add(Settings.Secure.TETHER_SUPPORTED);
- sSecureGlobalKeys.add(Settings.Secure.THROTTLE_HELP_URI);
- sSecureGlobalKeys.add(Settings.Secure.THROTTLE_MAX_NTP_CACHE_AGE_SEC);
- sSecureGlobalKeys.add(Settings.Secure.THROTTLE_NOTIFICATION_TYPE);
- sSecureGlobalKeys.add(Settings.Secure.THROTTLE_POLLING_SEC);
- sSecureGlobalKeys.add(Settings.Secure.THROTTLE_RESET_DAY);
- sSecureGlobalKeys.add(Settings.Secure.THROTTLE_THRESHOLD_BYTES);
- sSecureGlobalKeys.add(Settings.Secure.THROTTLE_VALUE_KBITSPS);
- sSecureGlobalKeys.add(Settings.Secure.USB_MASS_STORAGE_ENABLED);
- sSecureGlobalKeys.add(Settings.Secure.USE_GOOGLE_MAIL);
- sSecureGlobalKeys.add(Settings.Secure.WEB_AUTOFILL_QUERY_URL);
- sSecureGlobalKeys.add(Settings.Secure.WIFI_COUNTRY_CODE);
- sSecureGlobalKeys.add(Settings.Secure.WIFI_FRAMEWORK_SCAN_INTERVAL_MS);
- sSecureGlobalKeys.add(Settings.Secure.WIFI_FREQUENCY_BAND);
- sSecureGlobalKeys.add(Settings.Secure.WIFI_IDLE_MS);
- sSecureGlobalKeys.add(Settings.Secure.WIFI_MAX_DHCP_RETRY_COUNT);
- sSecureGlobalKeys.add(Settings.Secure.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS);
- sSecureGlobalKeys.add(Settings.Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON);
- sSecureGlobalKeys.add(Settings.Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY);
- sSecureGlobalKeys.add(Settings.Secure.WIFI_NUM_OPEN_NETWORKS_KEPT);
- sSecureGlobalKeys.add(Settings.Secure.WIFI_ON);
- sSecureGlobalKeys.add(Settings.Secure.WIFI_P2P_DEVICE_NAME);
- sSecureGlobalKeys.add(Settings.Secure.WIFI_SAVED_STATE);
- sSecureGlobalKeys.add(Settings.Secure.WIFI_SUPPLICANT_SCAN_INTERVAL_MS);
- sSecureGlobalKeys.add(Settings.Secure.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED);
- sSecureGlobalKeys.add(Settings.Secure.WIFI_WATCHDOG_NUM_ARP_PINGS);
- sSecureGlobalKeys.add(Settings.Secure.WIFI_WATCHDOG_ON);
- sSecureGlobalKeys.add(Settings.Secure.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED);
- sSecureGlobalKeys.add(Settings.Secure.WIFI_WATCHDOG_RSSI_FETCH_INTERVAL_MS);
- sSecureGlobalKeys.add(Settings.Secure.WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON);
- sSecureGlobalKeys.add(Settings.Secure.PACKAGE_VERIFIER_ENABLE);
- sSecureGlobalKeys.add(Settings.Secure.PACKAGE_VERIFIER_TIMEOUT);
- sSecureGlobalKeys.add(Settings.Secure.PACKAGE_VERIFIER_DEFAULT_RESPONSE);
- sSecureGlobalKeys.add(Settings.Secure.DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS);
- sSecureGlobalKeys.add(Settings.Secure.DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS);
- sSecureGlobalKeys.add(Settings.Secure.GPRS_REGISTER_CHECK_PERIOD_MS);
- sSecureGlobalKeys.add(Settings.Secure.WTF_IS_FATAL);
+ sSecureGlobalKeys.add(Settings.Global.ADB_ENABLED);
+ sSecureGlobalKeys.add(Settings.Global.ASSISTED_GPS_ENABLED);
+ sSecureGlobalKeys.add(Settings.Global.BLUETOOTH_ON);
+ sSecureGlobalKeys.add(Settings.Global.CDMA_CELL_BROADCAST_SMS);
+ sSecureGlobalKeys.add(Settings.Global.CDMA_ROAMING_MODE);
+ sSecureGlobalKeys.add(Settings.Global.CDMA_SUBSCRIPTION_MODE);
+ sSecureGlobalKeys.add(Settings.Global.DATA_ACTIVITY_TIMEOUT_MOBILE);
+ sSecureGlobalKeys.add(Settings.Global.DATA_ACTIVITY_TIMEOUT_WIFI);
+ sSecureGlobalKeys.add(Settings.Global.DATA_ROAMING);
+ sSecureGlobalKeys.add(Settings.Global.DEVELOPMENT_SETTINGS_ENABLED);
+ sSecureGlobalKeys.add(Settings.Global.DEVICE_PROVISIONED);
+ sSecureGlobalKeys.add(Settings.Global.DISPLAY_DENSITY_FORCED);
+ sSecureGlobalKeys.add(Settings.Global.DISPLAY_SIZE_FORCED);
+ sSecureGlobalKeys.add(Settings.Global.DOWNLOAD_MAX_BYTES_OVER_MOBILE);
+ sSecureGlobalKeys.add(Settings.Global.DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE);
+ sSecureGlobalKeys.add(Settings.Global.INSTALL_NON_MARKET_APPS);
+ sSecureGlobalKeys.add(Settings.Global.MOBILE_DATA);
+ sSecureGlobalKeys.add(Settings.Global.NETSTATS_DEV_BUCKET_DURATION);
+ sSecureGlobalKeys.add(Settings.Global.NETSTATS_DEV_DELETE_AGE);
+ sSecureGlobalKeys.add(Settings.Global.NETSTATS_DEV_PERSIST_BYTES);
+ sSecureGlobalKeys.add(Settings.Global.NETSTATS_DEV_ROTATE_AGE);
+ sSecureGlobalKeys.add(Settings.Global.NETSTATS_ENABLED);
+ sSecureGlobalKeys.add(Settings.Global.NETSTATS_GLOBAL_ALERT_BYTES);
+ sSecureGlobalKeys.add(Settings.Global.NETSTATS_POLL_INTERVAL);
+ sSecureGlobalKeys.add(Settings.Global.NETSTATS_REPORT_XT_OVER_DEV);
+ sSecureGlobalKeys.add(Settings.Global.NETSTATS_SAMPLE_ENABLED);
+ sSecureGlobalKeys.add(Settings.Global.NETSTATS_TIME_CACHE_MAX_AGE);
+ sSecureGlobalKeys.add(Settings.Global.NETSTATS_UID_BUCKET_DURATION);
+ sSecureGlobalKeys.add(Settings.Global.NETSTATS_UID_DELETE_AGE);
+ sSecureGlobalKeys.add(Settings.Global.NETSTATS_UID_PERSIST_BYTES);
+ sSecureGlobalKeys.add(Settings.Global.NETSTATS_UID_ROTATE_AGE);
+ sSecureGlobalKeys.add(Settings.Global.NETSTATS_UID_TAG_BUCKET_DURATION);
+ sSecureGlobalKeys.add(Settings.Global.NETSTATS_UID_TAG_DELETE_AGE);
+ sSecureGlobalKeys.add(Settings.Global.NETSTATS_UID_TAG_PERSIST_BYTES);
+ sSecureGlobalKeys.add(Settings.Global.NETSTATS_UID_TAG_ROTATE_AGE);
+ sSecureGlobalKeys.add(Settings.Global.NETWORK_PREFERENCE);
+ sSecureGlobalKeys.add(Settings.Global.NITZ_UPDATE_DIFF);
+ sSecureGlobalKeys.add(Settings.Global.NITZ_UPDATE_SPACING);
+ sSecureGlobalKeys.add(Settings.Global.NTP_SERVER);
+ sSecureGlobalKeys.add(Settings.Global.NTP_TIMEOUT);
+ sSecureGlobalKeys.add(Settings.Global.PDP_WATCHDOG_ERROR_POLL_COUNT);
+ sSecureGlobalKeys.add(Settings.Global.PDP_WATCHDOG_LONG_POLL_INTERVAL_MS);
+ sSecureGlobalKeys.add(Settings.Global.PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT);
+ sSecureGlobalKeys.add(Settings.Global.PDP_WATCHDOG_POLL_INTERVAL_MS);
+ sSecureGlobalKeys.add(Settings.Global.PDP_WATCHDOG_TRIGGER_PACKET_COUNT);
+ sSecureGlobalKeys.add(Settings.Global.SAMPLING_PROFILER_MS);
+ sSecureGlobalKeys.add(Settings.Global.SETUP_PREPAID_DATA_SERVICE_URL);
+ sSecureGlobalKeys.add(Settings.Global.SETUP_PREPAID_DETECTION_REDIR_HOST);
+ sSecureGlobalKeys.add(Settings.Global.SETUP_PREPAID_DETECTION_TARGET_URL);
+ sSecureGlobalKeys.add(Settings.Global.TETHER_DUN_APN);
+ sSecureGlobalKeys.add(Settings.Global.TETHER_DUN_REQUIRED);
+ sSecureGlobalKeys.add(Settings.Global.TETHER_SUPPORTED);
+ sSecureGlobalKeys.add(Settings.Global.THROTTLE_HELP_URI);
+ sSecureGlobalKeys.add(Settings.Global.THROTTLE_MAX_NTP_CACHE_AGE_SEC);
+ sSecureGlobalKeys.add(Settings.Global.THROTTLE_NOTIFICATION_TYPE);
+ sSecureGlobalKeys.add(Settings.Global.THROTTLE_POLLING_SEC);
+ sSecureGlobalKeys.add(Settings.Global.THROTTLE_RESET_DAY);
+ sSecureGlobalKeys.add(Settings.Global.THROTTLE_THRESHOLD_BYTES);
+ sSecureGlobalKeys.add(Settings.Global.THROTTLE_VALUE_KBITSPS);
+ sSecureGlobalKeys.add(Settings.Global.USB_MASS_STORAGE_ENABLED);
+ sSecureGlobalKeys.add(Settings.Global.USE_GOOGLE_MAIL);
+ sSecureGlobalKeys.add(Settings.Global.WEB_AUTOFILL_QUERY_URL);
+ sSecureGlobalKeys.add(Settings.Global.WIFI_COUNTRY_CODE);
+ sSecureGlobalKeys.add(Settings.Global.WIFI_FRAMEWORK_SCAN_INTERVAL_MS);
+ sSecureGlobalKeys.add(Settings.Global.WIFI_FREQUENCY_BAND);
+ sSecureGlobalKeys.add(Settings.Global.WIFI_IDLE_MS);
+ sSecureGlobalKeys.add(Settings.Global.WIFI_MAX_DHCP_RETRY_COUNT);
+ sSecureGlobalKeys.add(Settings.Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS);
+ sSecureGlobalKeys.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON);
+ sSecureGlobalKeys.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY);
+ sSecureGlobalKeys.add(Settings.Global.WIFI_NUM_OPEN_NETWORKS_KEPT);
+ sSecureGlobalKeys.add(Settings.Global.WIFI_ON);
+ sSecureGlobalKeys.add(Settings.Global.WIFI_P2P_DEVICE_NAME);
+ sSecureGlobalKeys.add(Settings.Global.WIFI_SAVED_STATE);
+ sSecureGlobalKeys.add(Settings.Global.WIFI_SUPPLICANT_SCAN_INTERVAL_MS);
+ sSecureGlobalKeys.add(Settings.Global.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED);
+ sSecureGlobalKeys.add(Settings.Global.WIFI_WATCHDOG_NUM_ARP_PINGS);
+ sSecureGlobalKeys.add(Settings.Global.WIFI_WATCHDOG_ON);
+ sSecureGlobalKeys.add(Settings.Global.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED);
+ sSecureGlobalKeys.add(Settings.Global.WIFI_WATCHDOG_RSSI_FETCH_INTERVAL_MS);
+ sSecureGlobalKeys.add(Settings.Global.WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON);
+ sSecureGlobalKeys.add(Settings.Global.PACKAGE_VERIFIER_ENABLE);
+ sSecureGlobalKeys.add(Settings.Global.PACKAGE_VERIFIER_TIMEOUT);
+ sSecureGlobalKeys.add(Settings.Global.PACKAGE_VERIFIER_DEFAULT_RESPONSE);
+ sSecureGlobalKeys.add(Settings.Global.DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS);
+ sSecureGlobalKeys.add(Settings.Global.DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS);
+ sSecureGlobalKeys.add(Settings.Global.GPRS_REGISTER_CHECK_PERIOD_MS);
+ sSecureGlobalKeys.add(Settings.Global.WTF_IS_FATAL);
// Keys from the 'system' table now moved to 'global'
// These must match Settings.System.MOVED_TO_GLOBAL
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index 4d241ed..a7294ec 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -5,6 +5,7 @@
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ <uses-permission android:name="android.permission.ACCESS_ALL_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.INJECT_EVENTS" />
diff --git a/packages/SystemUI/res/drawable-hdpi/status_bar_close_off.9.png b/packages/SystemUI/res/drawable-hdpi/status_bar_close_off.9.png
index bc6462b..0c301ab 100644
--- a/packages/SystemUI/res/drawable-hdpi/status_bar_close_off.9.png
+++ b/packages/SystemUI/res/drawable-hdpi/status_bar_close_off.9.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/status_bar_close_on.9.png b/packages/SystemUI/res/drawable-hdpi/status_bar_close_on.9.png
index f4e28ae..ec0424a 100644
--- a/packages/SystemUI/res/drawable-hdpi/status_bar_close_on.9.png
+++ b/packages/SystemUI/res/drawable-hdpi/status_bar_close_on.9.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/status_bar_close_off.9.png b/packages/SystemUI/res/drawable-mdpi/status_bar_close_off.9.png
index 4f5bba5..5c577cb 100644
--- a/packages/SystemUI/res/drawable-mdpi/status_bar_close_off.9.png
+++ b/packages/SystemUI/res/drawable-mdpi/status_bar_close_off.9.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/status_bar_close_on.9.png b/packages/SystemUI/res/drawable-mdpi/status_bar_close_on.9.png
index ef7afb8..7efb502 100644
--- a/packages/SystemUI/res/drawable-mdpi/status_bar_close_on.9.png
+++ b/packages/SystemUI/res/drawable-mdpi/status_bar_close_on.9.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/status_bar_close_off.9.png b/packages/SystemUI/res/drawable-xhdpi/status_bar_close_off.9.png
index e243e50..98d0cfb 100644
--- a/packages/SystemUI/res/drawable-xhdpi/status_bar_close_off.9.png
+++ b/packages/SystemUI/res/drawable-xhdpi/status_bar_close_off.9.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/status_bar_close_on.9.png b/packages/SystemUI/res/drawable-xhdpi/status_bar_close_on.9.png
index cdad949..17f4169 100644
--- a/packages/SystemUI/res/drawable-xhdpi/status_bar_close_on.9.png
+++ b/packages/SystemUI/res/drawable-xhdpi/status_bar_close_on.9.png
Binary files differ
diff --git a/packages/SystemUI/src/com/android/systemui/Somnambulator.java b/packages/SystemUI/src/com/android/systemui/Somnambulator.java
index 89d4ef7..bd87238 100644
--- a/packages/SystemUI/src/com/android/systemui/Somnambulator.java
+++ b/packages/SystemUI/src/com/android/systemui/Somnambulator.java
@@ -20,6 +20,7 @@
import android.content.Intent;
import android.os.RemoteException;
import android.os.ServiceManager;
+import android.service.dreams.Dream;
import android.service.dreams.IDreamManager;
import android.util.Slog;
@@ -45,7 +46,7 @@
setResult(RESULT_OK, resultIntent);
} else {
IDreamManager somnambulist = IDreamManager.Stub.asInterface(
- ServiceManager.checkService("dreams"));
+ ServiceManager.checkService(Dream.DREAM_SERVICE));
if (somnambulist != null) {
try {
Slog.v("Somnambulator", "Dreaming by user request.");
diff --git a/packages/SystemUI/src/com/android/systemui/media/RingtonePlayer.java b/packages/SystemUI/src/com/android/systemui/media/RingtonePlayer.java
index 3502b62..0c6e59c 100644
--- a/packages/SystemUI/src/com/android/systemui/media/RingtonePlayer.java
+++ b/packages/SystemUI/src/com/android/systemui/media/RingtonePlayer.java
@@ -17,6 +17,7 @@
package com.android.systemui.media;
import android.content.Context;
+import android.content.pm.PackageManager.NameNotFoundException;
import android.media.IAudioService;
import android.media.IRingtonePlayer;
import android.media.Ringtone;
@@ -26,6 +27,7 @@
import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
+import android.os.UserHandle;
import android.util.Slog;
import com.android.systemui.SystemUI;
@@ -70,9 +72,10 @@
private final IBinder mToken;
private final Ringtone mRingtone;
- public Client(IBinder token, Uri uri, int streamType) {
+ public Client(IBinder token, Uri uri, UserHandle user, int streamType) {
mToken = token;
- mRingtone = new Ringtone(mContext, false);
+
+ mRingtone = new Ringtone(getContextForUser(user), false);
mRingtone.setStreamType(streamType);
mRingtone.setUri(uri);
}
@@ -90,12 +93,16 @@
private IRingtonePlayer mCallback = new IRingtonePlayer.Stub() {
@Override
public void play(IBinder token, Uri uri, int streamType) throws RemoteException {
- if (LOGD) Slog.d(TAG, "play(token=" + token + ", uri=" + uri + ")");
+ if (LOGD) {
+ Slog.d(TAG, "play(token=" + token + ", uri=" + uri + ", uid="
+ + Binder.getCallingUid() + ")");
+ }
Client client;
synchronized (mClients) {
client = mClients.get(token);
if (client == null) {
- client = new Client(token, uri, streamType);
+ final UserHandle user = Binder.getCallingUserHandle();
+ client = new Client(token, uri, user, streamType);
token.linkToDeath(client, 0);
mClients.put(token, client);
}
@@ -131,12 +138,13 @@
}
@Override
- public void playAsync(Uri uri, boolean looping, int streamType) {
- if (LOGD) Slog.d(TAG, "playAsync(uri=" + uri + ")");
+ public void playAsync(Uri uri, UserHandle user, boolean looping, int streamType) {
+ if (LOGD) Slog.d(TAG, "playAsync(uri=" + uri + ", user=" + user + ")");
if (Binder.getCallingUid() != Process.SYSTEM_UID) {
throw new SecurityException("Async playback only available from system UID.");
}
- mAsyncPlayer.play(mContext, uri, looping, streamType);
+
+ mAsyncPlayer.play(getContextForUser(user), uri, looping, streamType);
}
@Override
@@ -149,6 +157,14 @@
}
};
+ private Context getContextForUser(UserHandle user) {
+ try {
+ return mContext.createPackageContextAsUser(mContext.getPackageName(), 0, user);
+ } catch (NameNotFoundException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
@Override
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
pw.println("Clients:");
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index e6aa632..d72632f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -45,6 +45,7 @@
import android.os.SystemClock;
import android.os.UserHandle;
import android.provider.Settings;
+import android.service.dreams.Dream;
import android.service.dreams.IDreamManager;
import android.util.DisplayMetrics;
import android.util.Log;
@@ -262,7 +263,7 @@
.getDefaultDisplay();
mDreamManager = IDreamManager.Stub.asInterface(
- ServiceManager.checkService("dreams"));
+ ServiceManager.checkService(Dream.DREAM_SERVICE));
super.start(); // calls createAndAddWindows()
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index ceb17c7..891cac7 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -1509,8 +1509,8 @@
// which is where we store the value and maybe make this
// asynchronous.
enforceAccessPermission();
- boolean retVal = Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.MOBILE_DATA, 1) == 1;
+ boolean retVal = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.MOBILE_DATA, 1) == 1;
if (VDBG) log("getMobileDataEnabled returning " + retVal);
return retVal;
}
diff --git a/services/java/com/android/server/DockObserver.java b/services/java/com/android/server/DockObserver.java
index 8ad5a91..4a8bf72 100644
--- a/services/java/com/android/server/DockObserver.java
+++ b/services/java/com/android/server/DockObserver.java
@@ -16,9 +16,6 @@
package com.android.server;
-import static android.provider.Settings.Secure.SCREENSAVER_ACTIVATE_ON_DOCK;
-import static android.provider.Settings.Secure.SCREENSAVER_ENABLED;
-
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
@@ -27,16 +24,12 @@
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Handler;
-import android.os.Looper;
import android.os.Message;
-import android.os.RemoteException;
-import android.os.ServiceManager;
import android.os.PowerManager;
import android.os.SystemClock;
import android.os.UEventObserver;
import android.os.UserHandle;
import android.provider.Settings;
-import android.service.dreams.IDreamManager;
import android.util.Log;
import android.util.Slog;
@@ -48,14 +41,10 @@
*/
final class DockObserver extends UEventObserver {
private static final String TAG = DockObserver.class.getSimpleName();
- private static final boolean LOG = false;
private static final String DOCK_UEVENT_MATCH = "DEVPATH=/devices/virtual/switch/dock";
private static final String DOCK_STATE_PATH = "/sys/class/switch/dock/state";
- private static final int DEFAULT_SCREENSAVER_ENABLED = 1;
- private static final int DEFAULT_SCREENSAVER_ACTIVATED_ON_DOCK = 1;
-
private static final int MSG_DOCK_STATE_CHANGED = 0;
private final Object mLock = new Object();
@@ -66,11 +55,16 @@
private boolean mSystemReady;
private final Context mContext;
+ private final PowerManager mPowerManager;
+ private final PowerManager.WakeLock mWakeLock;
public DockObserver(Context context) {
mContext = context;
- init(); // set initial status
+ mPowerManager = (PowerManager)mContext.getSystemService(Context.POWER_SERVICE);
+ mWakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
+
+ init(); // set initial status
startObserving(DOCK_UEVENT_MATCH);
}
@@ -87,17 +81,9 @@
mPreviousDockState = mDockState;
mDockState = newState;
if (mSystemReady) {
- // Don't force screen on when undocking from the desk dock.
- // The change in power state will do this anyway.
- // FIXME - we should be configurable.
- if ((mPreviousDockState != Intent.EXTRA_DOCK_STATE_DESK
- && mPreviousDockState != Intent.EXTRA_DOCK_STATE_LE_DESK
- && mPreviousDockState != Intent.EXTRA_DOCK_STATE_HE_DESK) ||
- mDockState != Intent.EXTRA_DOCK_STATE_UNDOCKED) {
- PowerManager pm =
- (PowerManager)mContext.getSystemService(Context.POWER_SERVICE);
- pm.wakeUp(SystemClock.uptimeMillis());
- }
+ // Wake up immediately when docked or undocked.
+ mPowerManager.wakeUp(SystemClock.uptimeMillis());
+
updateLocked();
}
}
@@ -138,6 +124,7 @@
}
private void updateLocked() {
+ mWakeLock.acquire();
mHandler.sendEmptyMessage(MSG_DOCK_STATE_CHANGED);
}
@@ -145,8 +132,8 @@
synchronized (mLock) {
Slog.i(TAG, "Dock state changed: " + mDockState);
+ // Skip the dock intent if not yet provisioned.
final ContentResolver cr = mContext.getContentResolver();
-
if (Settings.Global.getInt(cr,
Settings.Global.DEVICE_PROVISIONED, 0) == 0) {
Slog.i(TAG, "Device not provisioned, skipping dock broadcast");
@@ -158,16 +145,8 @@
intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
intent.putExtra(Intent.EXTRA_DOCK_STATE, mDockState);
- // Check if this is Bluetooth Dock
- // TODO(BT): Get Dock address.
- // String address = null;
- // if (address != null) {
- // intent.putExtra(BluetoothDevice.EXTRA_DEVICE,
- // BluetoothAdapter.getDefaultAdapter().getRemoteDevice(address));
- // }
-
- // User feedback to confirm dock connection. Particularly
- // useful for flaky contact pins...
+ // Play a sound to provide feedback to confirm dock connection.
+ // Particularly useful for flaky contact pins...
if (Settings.Global.getInt(cr,
Settings.Global.DOCK_SOUNDS_ENABLED, 1) == 1) {
String whichSound = null;
@@ -204,44 +183,16 @@
}
}
- IDreamManager mgr = IDreamManager.Stub.asInterface(ServiceManager.getService("dreams"));
- if (mgr != null) {
- // dreams feature enabled
- boolean undocked = mDockState == Intent.EXTRA_DOCK_STATE_UNDOCKED;
- if (undocked) {
- try {
- if (mgr.isDreaming()) {
- mgr.awaken();
- }
- } catch (RemoteException e) {
- Slog.w(TAG, "Unable to awaken!", e);
- }
- } else {
- if (isScreenSaverEnabled(mContext) && isScreenSaverActivatedOnDock(mContext)) {
- try {
- mgr.dream();
- } catch (RemoteException e) {
- Slog.w(TAG, "Unable to dream!", e);
- }
- }
- }
- } else {
- // dreams feature not enabled, send legacy intent
- mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL);
- }
+ // Send the dock event intent.
+ // There are many components in the system watching for this so as to
+ // adjust audio routing, screen orientation, etc.
+ mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL);
+
+ // Release the wake lock that was acquired when the message was posted.
+ mWakeLock.release();
}
}
- private static boolean isScreenSaverEnabled(Context context) {
- return Settings.Secure.getInt(context.getContentResolver(),
- SCREENSAVER_ENABLED, DEFAULT_SCREENSAVER_ENABLED) != 0;
- }
-
- private static boolean isScreenSaverActivatedOnDock(Context context) {
- return Settings.Secure.getInt(context.getContentResolver(),
- SCREENSAVER_ACTIVATE_ON_DOCK, DEFAULT_SCREENSAVER_ACTIVATED_ON_DOCK) != 0;
- }
-
private final Handler mHandler = new Handler(true /*async*/) {
@Override
public void handleMessage(Message msg) {
diff --git a/services/java/com/android/server/DreamController.java b/services/java/com/android/server/DreamController.java
deleted file mode 100644
index 498e581..0000000
--- a/services/java/com/android/server/DreamController.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.server;
-
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.os.Binder;
-import android.os.Handler;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.os.IBinder.DeathRecipient;
-import android.service.dreams.IDreamService;
-import android.util.Slog;
-import android.view.IWindowManager;
-import android.view.WindowManager;
-import android.view.WindowManagerGlobal;
-
-import com.android.internal.util.DumpUtils;
-
-import java.io.PrintWriter;
-import java.util.NoSuchElementException;
-
-/**
- * Internal controller for starting and stopping the current dream and managing related state.
- *
- * Assumes all operations (except {@link #dump}) are called from a single thread.
- */
-final class DreamController {
- private static final boolean DEBUG = true;
- private static final String TAG = DreamController.class.getSimpleName();
-
- public interface Listener {
- void onDreamStopped(boolean wasTest);
- }
-
- private final Context mContext;
- private final IWindowManager mIWindowManager;
- private final DeathRecipient mDeathRecipient;
- private final ServiceConnection mServiceConnection;
- private final Listener mListener;
-
- private Handler mHandler;
-
- private ComponentName mCurrentDreamComponent;
- private IDreamService mCurrentDream;
- private Binder mCurrentDreamToken;
- private boolean mCurrentDreamIsTest;
-
- public DreamController(Context context, DeathRecipient deathRecipient,
- ServiceConnection serviceConnection, Listener listener) {
- mContext = context;
- mDeathRecipient = deathRecipient;
- mServiceConnection = serviceConnection;
- mListener = listener;
- mIWindowManager = WindowManagerGlobal.getWindowManagerService();
- }
-
- public void setHandler(Handler handler) {
- mHandler = handler;
- }
-
- public void dump(PrintWriter pw) {
- if (mHandler== null || pw == null) {
- return;
- }
- DumpUtils.dumpAsync(mHandler, new DumpUtils.Dump() {
- @Override
- public void dump(PrintWriter pw) {
- pw.print(" component="); pw.println(mCurrentDreamComponent);
- pw.print(" token="); pw.println(mCurrentDreamToken);
- pw.print(" dream="); pw.println(mCurrentDream);
- }
- }, pw, 200);
- }
-
- public void start(ComponentName dream, boolean isTest) {
- if (DEBUG) Slog.v(TAG, String.format("start(%s,%s)", dream, isTest));
-
- if (mCurrentDreamComponent != null ) {
- if (dream.equals(mCurrentDreamComponent) && isTest == mCurrentDreamIsTest) {
- if (DEBUG) Slog.v(TAG, "Dream is already started: " + dream);
- return;
- }
- // stop the current dream before starting a new one
- stop();
- }
-
- mCurrentDreamComponent = dream;
- mCurrentDreamIsTest = isTest;
- mCurrentDreamToken = new Binder();
-
- try {
- if (DEBUG) Slog.v(TAG, "Adding window token: " + mCurrentDreamToken
- + " for window type: " + WindowManager.LayoutParams.TYPE_DREAM);
- mIWindowManager.addWindowToken(mCurrentDreamToken,
- WindowManager.LayoutParams.TYPE_DREAM);
- } catch (RemoteException e) {
- Slog.w(TAG, "Unable to add window token.");
- stop();
- return;
- }
-
- Intent intent = new Intent(Intent.ACTION_MAIN)
- .setComponent(mCurrentDreamComponent)
- .addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
- .putExtra("android.dreams.TEST", mCurrentDreamIsTest);
-
- if (!mContext.bindService(intent, mServiceConnection, Context.BIND_AUTO_CREATE)) {
- Slog.w(TAG, "Unable to bind service");
- stop();
- return;
- }
- if (DEBUG) Slog.v(TAG, "Bound service");
- }
-
- public void attach(ComponentName name, IBinder dream) {
- if (DEBUG) Slog.v(TAG, String.format("attach(%s,%s)", name, dream));
- mCurrentDream = IDreamService.Stub.asInterface(dream);
-
- boolean linked = linkDeathRecipient(dream);
- if (!linked) {
- stop();
- return;
- }
-
- try {
- if (DEBUG) Slog.v(TAG, "Attaching with token:" + mCurrentDreamToken);
- mCurrentDream.attach(mCurrentDreamToken);
- } catch (Throwable ex) {
- Slog.w(TAG, "Unable to send window token to dream:" + ex);
- stop();
- }
- }
-
- public void stop() {
- if (DEBUG) Slog.v(TAG, "stop()");
-
- if (mCurrentDream != null) {
- unlinkDeathRecipient(mCurrentDream.asBinder());
-
- if (DEBUG) Slog.v(TAG, "Unbinding: " + mCurrentDreamComponent + " service: " + mCurrentDream);
- mContext.unbindService(mServiceConnection);
- }
- if (mCurrentDreamToken != null) {
- removeWindowToken(mCurrentDreamToken);
- }
-
- final boolean wasTest = mCurrentDreamIsTest;
- mCurrentDream = null;
- mCurrentDreamToken = null;
- mCurrentDreamComponent = null;
- mCurrentDreamIsTest = false;
-
- if (mListener != null && mHandler != null) {
- mHandler.post(new Runnable(){
- @Override
- public void run() {
- mListener.onDreamStopped(wasTest);
- }});
- }
- }
-
- public void stopSelf(IBinder token) {
- if (DEBUG) Slog.v(TAG, String.format("stopSelf(%s)", token));
- if (token == null || token != mCurrentDreamToken) {
- Slog.w(TAG, "Stop requested for non-current dream token: " + token);
- } else {
- stop();
- }
- }
-
- private void removeWindowToken(IBinder token) {
- if (DEBUG) Slog.v(TAG, "Removing window token: " + token);
- try {
- mIWindowManager.removeWindowToken(token);
- } catch (Throwable e) {
- Slog.w(TAG, "Error removing window token", e);
- }
- }
-
- private boolean linkDeathRecipient(IBinder dream) {
- if (DEBUG) Slog.v(TAG, "Linking death recipient");
- try {
- dream.linkToDeath(mDeathRecipient, 0);
- return true;
- } catch (RemoteException e) {
- Slog.w(TAG, "Unable to link death recipient", e);
- return false;
- }
- }
-
- private void unlinkDeathRecipient(IBinder dream) {
- if (DEBUG) Slog.v(TAG, "Unlinking death recipient");
- try {
- dream.unlinkToDeath(mDeathRecipient, 0);
- } catch (NoSuchElementException e) {
- // we tried
- }
- }
-
-}
\ No newline at end of file
diff --git a/services/java/com/android/server/DreamManagerService.java b/services/java/com/android/server/DreamManagerService.java
deleted file mode 100644
index b02ea7f..0000000
--- a/services/java/com/android/server/DreamManagerService.java
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.server;
-
-import static android.provider.Settings.Secure.SCREENSAVER_COMPONENTS;
-import static android.provider.Settings.Secure.SCREENSAVER_DEFAULT_COMPONENT;
-
-import android.app.ActivityManagerNative;
-import android.content.BroadcastReceiver;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.ServiceConnection;
-import android.content.pm.PackageManager;
-import android.os.Binder;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.IBinder;
-import android.os.Message;
-import android.os.RemoteException;
-import android.os.UserHandle;
-import android.provider.Settings;
-import android.service.dreams.Dream;
-import android.service.dreams.IDreamManager;
-import android.util.Slog;
-import android.util.SparseArray;
-
-import java.io.FileDescriptor;
-import java.io.PrintWriter;
-
-/**
- * Service api for managing dreams.
- *
- * @hide
- */
-public final class DreamManagerService
- extends IDreamManager.Stub
- implements ServiceConnection {
- private static final boolean DEBUG = true;
- private static final String TAG = DreamManagerService.class.getSimpleName();
-
- private static final Intent mDreamingStartedIntent = new Intent(Dream.ACTION_DREAMING_STARTED)
- .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
- private static final Intent mDreamingStoppedIntent = new Intent(Dream.ACTION_DREAMING_STOPPED)
- .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
-
- private final Object mLock = new Object();
- private final DreamController mController;
- private final DreamControllerHandler mHandler;
- private final Context mContext;
-
- private final CurrentUserManager mCurrentUserManager = new CurrentUserManager();
-
- private final DeathRecipient mAwakenOnBinderDeath = new DeathRecipient() {
- @Override
- public void binderDied() {
- if (DEBUG) Slog.v(TAG, "binderDied()");
- awaken();
- }
- };
-
- private final DreamController.Listener mControllerListener = new DreamController.Listener() {
- @Override
- public void onDreamStopped(boolean wasTest) {
- synchronized(mLock) {
- setDreamingLocked(false, wasTest);
- }
- }};
-
- private boolean mIsDreaming;
-
- public DreamManagerService(Context context) {
- if (DEBUG) Slog.v(TAG, "DreamManagerService startup");
- mContext = context;
- mController = new DreamController(context, mAwakenOnBinderDeath, this, mControllerListener);
- mHandler = new DreamControllerHandler(mController);
- mController.setHandler(mHandler);
- }
-
- public void systemReady() {
- mCurrentUserManager.init(mContext);
-
- if (DEBUG) Slog.v(TAG, "Ready to dream!");
- }
-
- @Override
- protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
- mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);
-
- pw.println("Dreamland:");
- mController.dump(pw);
- mCurrentUserManager.dump(pw);
- }
-
- // begin IDreamManager api
- @Override
- public ComponentName[] getDreamComponents() {
- checkPermission(android.Manifest.permission.READ_DREAM_STATE);
- int userId = UserHandle.getCallingUserId();
-
- final long ident = Binder.clearCallingIdentity();
- try {
- return getDreamComponentsForUser(userId);
- } finally {
- Binder.restoreCallingIdentity(ident);
- }
- }
-
- @Override
- public void setDreamComponents(ComponentName[] componentNames) {
- checkPermission(android.Manifest.permission.WRITE_DREAM_STATE);
- int userId = UserHandle.getCallingUserId();
-
- final long ident = Binder.clearCallingIdentity();
- try {
- Settings.Secure.putStringForUser(mContext.getContentResolver(),
- SCREENSAVER_COMPONENTS,
- componentsToString(componentNames),
- userId);
- } finally {
- Binder.restoreCallingIdentity(ident);
- }
- }
-
- @Override
- public ComponentName getDefaultDreamComponent() {
- checkPermission(android.Manifest.permission.READ_DREAM_STATE);
- int userId = UserHandle.getCallingUserId();
-
- final long ident = Binder.clearCallingIdentity();
- try {
- String name = Settings.Secure.getStringForUser(mContext.getContentResolver(),
- SCREENSAVER_DEFAULT_COMPONENT,
- userId);
- return name == null ? null : ComponentName.unflattenFromString(name);
- } finally {
- Binder.restoreCallingIdentity(ident);
- }
-
- }
-
- @Override
- public boolean isDreaming() {
- checkPermission(android.Manifest.permission.READ_DREAM_STATE);
-
- return mIsDreaming;
- }
-
- @Override
- public void dream() {
- checkPermission(android.Manifest.permission.WRITE_DREAM_STATE);
-
- final long ident = Binder.clearCallingIdentity();
- try {
- if (DEBUG) Slog.v(TAG, "Dream now");
- ComponentName[] dreams = getDreamComponentsForUser(mCurrentUserManager.getCurrentUserId());
- ComponentName firstDream = dreams != null && dreams.length > 0 ? dreams[0] : null;
- if (firstDream != null) {
- mHandler.requestStart(firstDream, false /*isTest*/);
- synchronized (mLock) {
- setDreamingLocked(true, false /*isTest*/);
- }
- }
- } finally {
- Binder.restoreCallingIdentity(ident);
- }
- }
-
- @Override
- public void testDream(ComponentName dream) {
- checkPermission(android.Manifest.permission.WRITE_DREAM_STATE);
-
- final long ident = Binder.clearCallingIdentity();
- try {
- if (DEBUG) Slog.v(TAG, "Test dream name=" + dream);
- if (dream != null) {
- mHandler.requestStart(dream, true /*isTest*/);
- synchronized (mLock) {
- setDreamingLocked(true, true /*isTest*/);
- }
- }
- } finally {
- Binder.restoreCallingIdentity(ident);
- }
-
- }
-
- @Override
- public void awaken() {
- checkPermission(android.Manifest.permission.WRITE_DREAM_STATE);
-
- final long ident = Binder.clearCallingIdentity();
- try {
- if (DEBUG) Slog.v(TAG, "Wake up");
- mHandler.requestStop();
- } finally {
- Binder.restoreCallingIdentity(ident);
- }
- }
-
- @Override
- public void awakenSelf(IBinder token) {
- // requires no permission, called by Dream from an arbitrary process
-
- final long ident = Binder.clearCallingIdentity();
- try {
- if (DEBUG) Slog.v(TAG, "Wake up from dream: " + token);
- if (token != null) {
- mHandler.requestStopSelf(token);
- }
- } finally {
- Binder.restoreCallingIdentity(ident);
- }
- }
- // end IDreamManager api
-
- // begin ServiceConnection
- @Override
- public void onServiceConnected(ComponentName name, IBinder dream) {
- if (DEBUG) Slog.v(TAG, "Service connected: " + name + " binder=" +
- dream + " thread=" + Thread.currentThread().getId());
- mHandler.requestAttach(name, dream);
- }
-
- @Override
- public void onServiceDisconnected(ComponentName name) {
- if (DEBUG) Slog.v(TAG, "Service disconnected: " + name);
- // Only happens in exceptional circumstances, awaken just to be safe
- awaken();
- }
- // end ServiceConnection
-
- private void checkPermission(String permission) {
- if (PackageManager.PERMISSION_GRANTED != mContext.checkCallingOrSelfPermission(permission)) {
- throw new SecurityException("Access denied to process: " + Binder.getCallingPid()
- + ", must have permission " + permission);
- }
- }
-
- private void setDreamingLocked(boolean isDreaming, boolean isTest) {
- boolean wasDreaming = mIsDreaming;
- if (!isTest) {
- if (!wasDreaming && isDreaming) {
- if (DEBUG) Slog.v(TAG, "Firing ACTION_DREAMING_STARTED");
- mContext.sendBroadcast(mDreamingStartedIntent);
- } else if (wasDreaming && !isDreaming) {
- if (DEBUG) Slog.v(TAG, "Firing ACTION_DREAMING_STOPPED");
- mContext.sendBroadcast(mDreamingStoppedIntent);
- }
- }
- mIsDreaming = isDreaming;
- }
-
- private ComponentName[] getDreamComponentsForUser(int userId) {
- String names = Settings.Secure.getStringForUser(mContext.getContentResolver(),
- SCREENSAVER_COMPONENTS,
- userId);
- return names == null ? null : componentsFromString(names);
- }
-
- private static String componentsToString(ComponentName[] componentNames) {
- StringBuilder names = new StringBuilder();
- if (componentNames != null) {
- for (ComponentName componentName : componentNames) {
- if (names.length() > 0) {
- names.append(',');
- }
- names.append(componentName.flattenToString());
- }
- }
- return names.toString();
- }
-
- private static ComponentName[] componentsFromString(String names) {
- String[] namesArray = names.split(",");
- ComponentName[] componentNames = new ComponentName[namesArray.length];
- for (int i = 0; i < namesArray.length; i++) {
- componentNames[i] = ComponentName.unflattenFromString(namesArray[i]);
- }
- return componentNames;
- }
-
- /**
- * Keeps track of the current user, since dream() uses the current user's configuration.
- */
- private static class CurrentUserManager {
- private final Object mLock = new Object();
- private int mCurrentUserId;
-
- public void init(Context context) {
- IntentFilter filter = new IntentFilter();
- filter.addAction(Intent.ACTION_USER_SWITCHED);
- context.registerReceiver(new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- String action = intent.getAction();
- if (Intent.ACTION_USER_SWITCHED.equals(action)) {
- synchronized(mLock) {
- mCurrentUserId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0);
- if (DEBUG) Slog.v(TAG, "userId " + mCurrentUserId + " is in the house");
- }
- }
- }}, filter);
- try {
- synchronized (mLock) {
- mCurrentUserId = ActivityManagerNative.getDefault().getCurrentUser().id;
- }
- } catch (RemoteException e) {
- Slog.w(TAG, "Couldn't get current user ID; guessing it's 0", e);
- }
- }
-
- public void dump(PrintWriter pw) {
- pw.print(" user="); pw.println(getCurrentUserId());
- }
-
- public int getCurrentUserId() {
- synchronized(mLock) {
- return mCurrentUserId;
- }
- }
- }
-
- /**
- * Handler for asynchronous operations performed by the dream manager.
- *
- * Ensures operations to {@link DreamController} are single-threaded.
- */
- private static final class DreamControllerHandler extends Handler {
- private final DreamController mController;
- private final Runnable mStopRunnable = new Runnable() {
- @Override
- public void run() {
- mController.stop();
- }};
-
- public DreamControllerHandler(DreamController controller) {
- super(true /*async*/);
- mController = controller;
- }
-
- public void requestStart(final ComponentName name, final boolean isTest) {
- post(new Runnable(){
- @Override
- public void run() {
- mController.start(name, isTest);
- }});
- }
-
- public void requestAttach(final ComponentName name, final IBinder dream) {
- post(new Runnable(){
- @Override
- public void run() {
- mController.attach(name, dream);
- }});
- }
-
- public void requestStopSelf(final IBinder token) {
- post(new Runnable(){
- @Override
- public void run() {
- mController.stopSelf(token);
- }});
- }
-
- public void requestStop() {
- post(mStopRunnable);
- }
-
- }
-
-}
diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java
index 578e602..a0c1552 100644
--- a/services/java/com/android/server/LocationManagerService.java
+++ b/services/java/com/android/server/LocationManagerService.java
@@ -17,17 +17,14 @@
package com.android.server;
import android.app.PendingIntent;
-import android.content.ContentQueryMap;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
-import android.content.IntentFilter;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Resources;
import android.database.ContentObserver;
-import android.database.Cursor;
import android.location.Address;
import android.location.Criteria;
import android.location.GeocoderParams;
@@ -41,7 +38,6 @@
import android.location.LocationManager;
import android.location.LocationProvider;
import android.location.LocationRequest;
-import android.net.ConnectivityManager;
import android.os.Binder;
import android.os.Bundle;
import android.os.Handler;
@@ -55,7 +51,6 @@
import android.os.UserHandle;
import android.os.WorkSource;
import android.provider.Settings;
-import android.provider.Settings.NameValueTable;
import android.util.Log;
import android.util.Slog;
@@ -80,8 +75,6 @@
import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Observable;
-import java.util.Observer;
import java.util.Set;
/**
@@ -1343,7 +1336,7 @@
// Check whether sufficient time has passed
long minTime = record.mRequest.getFastestInterval();
- long delta = (loc.getElapsedRealtimeNano() - lastLoc.getElapsedRealtimeNano()) / 1000000L;
+ long delta = (loc.getElapsedRealtimeNanos() - lastLoc.getElapsedRealtimeNanos()) / 1000000L;
if (delta < minTime - MAX_PROVIDER_SCHEDULING_JITTER_MS) {
return false;
}
diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java
index 76194ae..5d5f8d3 100755
--- a/services/java/com/android/server/NotificationManagerService.java
+++ b/services/java/com/android/server/NotificationManagerService.java
@@ -890,6 +890,7 @@
userId = ActivityManager.handleIncomingUser(callingPid,
callingUid, userId, true, true, "enqueueNotification", pkg);
+ final UserHandle user = new UserHandle(userId);
// Limit the number of notifications that any given package except the android
// package can enqueue. Prevents DOS attacks and deals with leaks.
@@ -991,7 +992,6 @@
}
if (notification.icon != 0) {
- final UserHandle user = new UserHandle(userId);
final StatusBarNotification n = new StatusBarNotification(
pkg, id, tag, r.uid, r.initialPid, score, notification, user);
if (old != null && old.statusBarKey != null) {
@@ -1063,7 +1063,7 @@
try {
final IRingtonePlayer player = mAudioService.getRingtonePlayer();
if (player != null) {
- player.playAsync(uri, looping, audioStreamType);
+ player.playAsync(uri, user, looping, audioStreamType);
}
} catch (RemoteException e) {
} finally {
diff --git a/services/java/com/android/server/ServiceWatcher.java b/services/java/com/android/server/ServiceWatcher.java
index 0dfaa05..e99949b 100644
--- a/services/java/com/android/server/ServiceWatcher.java
+++ b/services/java/com/android/server/ServiceWatcher.java
@@ -170,7 +170,7 @@
}
if (D) Log.d(mTag, "binding " + packageName + " (version " + version + ")");
mContext.bindService(intent, this, Context.BIND_AUTO_CREATE | Context.BIND_NOT_FOREGROUND
- | Context.BIND_ALLOW_OOM_MANAGEMENT);
+ | Context.BIND_ALLOW_OOM_MANAGEMENT | Context.BIND_NOT_VISIBLE);
}
private boolean isSignatureMatch(Signature[] signatures) {
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index eeab757..738e19b 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -38,6 +38,7 @@
import android.os.SystemClock;
import android.os.SystemProperties;
import android.server.search.SearchManagerService;
+import android.service.dreams.Dream;
import android.util.DisplayMetrics;
import android.util.EventLog;
import android.util.Log;
@@ -51,6 +52,7 @@
import com.android.server.am.ActivityManagerService;
import com.android.server.am.BatteryStatsService;
import com.android.server.display.DisplayManagerService;
+import com.android.server.dreams.DreamManagerService;
import com.android.server.input.InputManagerService;
import com.android.server.net.NetworkPolicyManagerService;
import com.android.server.net.NetworkStatsService;
@@ -738,8 +740,8 @@
try {
Slog.i(TAG, "Dreams Service");
// Dreams (interactive idle-time views, a/k/a screen savers)
- dreamy = new DreamManagerService(context);
- ServiceManager.addService("dreams", dreamy);
+ dreamy = new DreamManagerService(context, wmHandler);
+ ServiceManager.addService(Dream.DREAM_SERVICE, dreamy);
} catch (Throwable e) {
reportWtf("starting DreamManagerService", e);
}
@@ -810,7 +812,7 @@
context.getResources().updateConfiguration(config, metrics);
try {
- power.systemReady(twilight);
+ power.systemReady(twilight, dreamy);
} catch (Throwable e) {
reportWtf("making Power Manager Service ready", e);
}
diff --git a/services/java/com/android/server/ThrottleService.java b/services/java/com/android/server/ThrottleService.java
index f36d73a..75eb3c4 100644
--- a/services/java/com/android/server/ThrottleService.java
+++ b/services/java/com/android/server/ThrottleService.java
@@ -211,20 +211,20 @@
void register(Context context) {
ContentResolver resolver = context.getContentResolver();
- resolver.registerContentObserver(Settings.Secure.getUriFor(
- Settings.Secure.THROTTLE_POLLING_SEC), false, this);
- resolver.registerContentObserver(Settings.Secure.getUriFor(
- Settings.Secure.THROTTLE_THRESHOLD_BYTES), false, this);
- resolver.registerContentObserver(Settings.Secure.getUriFor(
- Settings.Secure.THROTTLE_VALUE_KBITSPS), false, this);
- resolver.registerContentObserver(Settings.Secure.getUriFor(
- Settings.Secure.THROTTLE_RESET_DAY), false, this);
- resolver.registerContentObserver(Settings.Secure.getUriFor(
- Settings.Secure.THROTTLE_NOTIFICATION_TYPE), false, this);
- resolver.registerContentObserver(Settings.Secure.getUriFor(
- Settings.Secure.THROTTLE_HELP_URI), false, this);
- resolver.registerContentObserver(Settings.Secure.getUriFor(
- Settings.Secure.THROTTLE_MAX_NTP_CACHE_AGE_SEC), false, this);
+ resolver.registerContentObserver(Settings.Global.getUriFor(
+ Settings.Global.THROTTLE_POLLING_SEC), false, this);
+ resolver.registerContentObserver(Settings.Global.getUriFor(
+ Settings.Global.THROTTLE_THRESHOLD_BYTES), false, this);
+ resolver.registerContentObserver(Settings.Global.getUriFor(
+ Settings.Global.THROTTLE_VALUE_KBITSPS), false, this);
+ resolver.registerContentObserver(Settings.Global.getUriFor(
+ Settings.Global.THROTTLE_RESET_DAY), false, this);
+ resolver.registerContentObserver(Settings.Global.getUriFor(
+ Settings.Global.THROTTLE_NOTIFICATION_TYPE), false, this);
+ resolver.registerContentObserver(Settings.Global.getUriFor(
+ Settings.Global.THROTTLE_HELP_URI), false, this);
+ resolver.registerContentObserver(Settings.Global.getUriFor(
+ Settings.Global.THROTTLE_MAX_NTP_CACHE_AGE_SEC), false, this);
}
void unregister(Context context) {
@@ -297,8 +297,8 @@
public String getHelpUri() {
enforceAccessPermission();
- return Settings.Secure.getString(mContext.getContentResolver(),
- Settings.Secure.THROTTLE_HELP_URI);
+ return Settings.Global.getString(mContext.getContentResolver(),
+ Settings.Global.THROTTLE_HELP_URI);
}
// TODO - fetch for the iface
@@ -436,18 +436,18 @@
int pollingPeriod = mContext.getResources().getInteger(
R.integer.config_datause_polling_period_sec);
- mPolicyPollPeriodSec = Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.THROTTLE_POLLING_SEC, pollingPeriod);
+ mPolicyPollPeriodSec = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.THROTTLE_POLLING_SEC, pollingPeriod);
// TODO - remove testing stuff?
long defaultThreshold = mContext.getResources().getInteger(
R.integer.config_datause_threshold_bytes);
int defaultValue = mContext.getResources().getInteger(
R.integer.config_datause_throttle_kbitsps);
- long threshold = Settings.Secure.getLong(mContext.getContentResolver(),
- Settings.Secure.THROTTLE_THRESHOLD_BYTES, defaultThreshold);
- int value = Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.THROTTLE_VALUE_KBITSPS, defaultValue);
+ long threshold = Settings.Global.getLong(mContext.getContentResolver(),
+ Settings.Global.THROTTLE_THRESHOLD_BYTES, defaultThreshold);
+ int value = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.THROTTLE_VALUE_KBITSPS, defaultValue);
mPolicyThreshold.set(threshold);
mPolicyThrottleValue.set(value);
@@ -456,14 +456,14 @@
mPolicyThreshold.set(TESTING_THRESHOLD);
}
- mPolicyResetDay = Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.THROTTLE_RESET_DAY, -1);
+ mPolicyResetDay = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.THROTTLE_RESET_DAY, -1);
if (mPolicyResetDay == -1 ||
((mPolicyResetDay < 1) || (mPolicyResetDay > 28))) {
Random g = new Random();
mPolicyResetDay = 1 + g.nextInt(28); // 1-28
- Settings.Secure.putInt(mContext.getContentResolver(),
- Settings.Secure.THROTTLE_RESET_DAY, mPolicyResetDay);
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.THROTTLE_RESET_DAY, mPolicyResetDay);
}
if (mIface == null) {
mPolicyThreshold.set(0);
@@ -471,11 +471,11 @@
int defaultNotificationType = mContext.getResources().getInteger(
R.integer.config_datause_notification_type);
- mPolicyNotificationsAllowedMask = Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.THROTTLE_NOTIFICATION_TYPE, defaultNotificationType);
+ mPolicyNotificationsAllowedMask = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.THROTTLE_NOTIFICATION_TYPE, defaultNotificationType);
- final int maxNtpCacheAgeSec = Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.THROTTLE_MAX_NTP_CACHE_AGE_SEC,
+ final int maxNtpCacheAgeSec = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.THROTTLE_MAX_NTP_CACHE_AGE_SEC,
(int) (MAX_NTP_CACHE_AGE / 1000));
mMaxNtpCacheAge = maxNtpCacheAgeSec * 1000;
diff --git a/services/java/com/android/server/TwilightService.java b/services/java/com/android/server/TwilightService.java
index a7bce54..154de1c 100644
--- a/services/java/com/android/server/TwilightService.java
+++ b/services/java/com/android/server/TwilightService.java
@@ -147,7 +147,7 @@
}
// if new location is older than the current one, the device hasn't moved.
- if (to.getElapsedRealtimeNano() < from.getElapsedRealtimeNano()) {
+ if (to.getElapsedRealtimeNanos() < from.getElapsedRealtimeNanos()) {
return false;
}
@@ -428,8 +428,8 @@
mLocationManager.getLastKnownLocation(providers.next());
// pick the most recent location
if (location == null || (lastKnownLocation != null &&
- location.getElapsedRealtimeNano() <
- lastKnownLocation.getElapsedRealtimeNano())) {
+ location.getElapsedRealtimeNanos() <
+ lastKnownLocation.getElapsedRealtimeNanos())) {
location = lastKnownLocation;
}
}
@@ -447,7 +447,7 @@
location.setLatitude(0);
location.setAccuracy(417000.0f);
location.setTime(System.currentTimeMillis());
- location.setElapsedRealtimeNano(SystemClock.elapsedRealtimeNano());
+ location.setElapsedRealtimeNanos(SystemClock.elapsedRealtimeNanos());
if (DEBUG) {
Slog.d(TAG, "Estimated location from timezone: " + location);
diff --git a/services/java/com/android/server/UiModeManagerService.java b/services/java/com/android/server/UiModeManagerService.java
index 85a6e41..3b8caba 100644
--- a/services/java/com/android/server/UiModeManagerService.java
+++ b/services/java/com/android/server/UiModeManagerService.java
@@ -17,6 +17,7 @@
package com.android.server;
import android.app.Activity;
+import android.app.ActivityManager;
import android.app.ActivityManagerNative;
import android.app.IUiModeManager;
import android.app.Notification;
@@ -24,7 +25,6 @@
import android.app.PendingIntent;
import android.app.StatusBarManager;
import android.app.UiModeManager;
-import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -39,6 +39,8 @@
import android.os.ServiceManager;
import android.os.UserHandle;
import android.provider.Settings;
+import android.service.dreams.Dream;
+import android.service.dreams.IDreamManager;
import android.util.Slog;
import java.io.FileDescriptor;
@@ -56,6 +58,9 @@
private static final boolean ENABLE_LAUNCH_CAR_DOCK_APP = true;
private static final boolean ENABLE_LAUNCH_DESK_DOCK_APP = true;
+ private static final int DEFAULT_SCREENSAVER_ENABLED = 1;
+ private static final int DEFAULT_SCREENSAVER_ACTIVATED_ON_DOCK = 1;
+
private final Context mContext;
private final TwilightService mTwilightService;
private final Handler mHandler = new Handler();
@@ -110,72 +115,10 @@
return;
}
- final int enableFlags = intent.getIntExtra("enableFlags", 0);
- final int disableFlags = intent.getIntExtra("disableFlags", 0);
-
+ final int enableFlags = intent.getIntExtra("enableFlags", 0);
+ final int disableFlags = intent.getIntExtra("disableFlags", 0);
synchronized (mLock) {
- // Launch a dock activity
- String category = null;
- if (UiModeManager.ACTION_ENTER_CAR_MODE.equals(intent.getAction())) {
- // Only launch car home when car mode is enabled and the caller
- // has asked us to switch to it.
- if (ENABLE_LAUNCH_CAR_DOCK_APP
- && (enableFlags&UiModeManager.ENABLE_CAR_MODE_GO_CAR_HOME) != 0) {
- category = Intent.CATEGORY_CAR_DOCK;
- }
- } else if (UiModeManager.ACTION_ENTER_DESK_MODE.equals(intent.getAction())) {
- // Only launch car home when desk mode is enabled and the caller
- // has asked us to switch to it. Currently re-using the car
- // mode flag since we don't have a formal API for "desk mode".
- if (ENABLE_LAUNCH_DESK_DOCK_APP
- && (enableFlags&UiModeManager.ENABLE_CAR_MODE_GO_CAR_HOME) != 0) {
- category = Intent.CATEGORY_DESK_DOCK;
- }
- } else {
- // Launch the standard home app if requested.
- if ((disableFlags&UiModeManager.DISABLE_CAR_MODE_GO_HOME) != 0) {
- category = Intent.CATEGORY_HOME;
- }
- }
-
- if (LOG) {
- Slog.v(TAG, String.format(
- "Handling broadcast result for action %s: enable=0x%08x disable=0x%08x category=%s",
- intent.getAction(), enableFlags, disableFlags, category));
- }
-
- if (category != null) {
- // This is the new activity that will serve as home while
- // we are in care mode.
- Intent homeIntent = buildHomeIntent(category);
-
- // Now we are going to be careful about switching the
- // configuration and starting the activity -- we need to
- // do this in a specific order under control of the
- // activity manager, to do it cleanly. So compute the
- // new config, but don't set it yet, and let the
- // activity manager take care of both the start and config
- // change.
- Configuration newConfig = null;
- if (mHoldingConfiguration) {
- mHoldingConfiguration = false;
- updateConfigurationLocked(false);
- newConfig = mConfiguration;
- }
- try {
- ActivityManagerNative.getDefault().startActivityWithConfig(
- null, homeIntent, null, null, null, 0, 0,
- newConfig, null, UserHandle.USER_CURRENT);
- mHoldingConfiguration = false;
- } catch (RemoteException e) {
- Slog.w(TAG, e.getCause());
- }
- }
-
- if (mHoldingConfiguration) {
- mHoldingConfiguration = false;
- updateConfigurationLocked(true);
- }
+ updateAfterBroadcastLocked(intent.getAction(), enableFlags, disableFlags);
}
}
};
@@ -335,9 +278,8 @@
}
}
- final void updateConfigurationLocked(boolean sendIt) {
- int uiMode = mTelevision ? Configuration.UI_MODE_TYPE_TELEVISION
- : mDefaultUiModeType;
+ final void updateConfigurationLocked() {
+ int uiMode = mTelevision ? Configuration.UI_MODE_TYPE_TELEVISION : mDefaultUiModeType;
if (mCarModeEnabled) {
uiMode = Configuration.UI_MODE_TYPE_CAR;
} else if (isDeskDockState(mDockState)) {
@@ -365,17 +307,19 @@
}
mCurUiMode = uiMode;
-
- if (!mHoldingConfiguration && uiMode != mSetUiMode) {
- mSetUiMode = uiMode;
+ if (!mHoldingConfiguration) {
mConfiguration.uiMode = uiMode;
+ }
+ }
- if (sendIt) {
- try {
- ActivityManagerNative.getDefault().updateConfiguration(mConfiguration);
- } catch (RemoteException e) {
- Slog.w(TAG, "Failure communicating with activity manager", e);
- }
+ final void sendConfigurationLocked() {
+ if (mSetUiMode != mConfiguration.uiMode) {
+ mSetUiMode = mConfiguration.uiMode;
+
+ try {
+ ActivityManagerNative.getDefault().updateConfiguration(mConfiguration);
+ } catch (RemoteException e) {
+ Slog.w(TAG, "Failure communicating with activity manager", e);
}
}
}
@@ -434,43 +378,38 @@
intent.putExtra("disableFlags", disableFlags);
mContext.sendOrderedBroadcastAsUser(intent, UserHandle.CURRENT, null,
mResultReceiver, null, Activity.RESULT_OK, null, null);
+
// Attempting to make this transition a little more clean, we are going
// to hold off on doing a configuration change until we have finished
// the broadcast and started the home activity.
mHoldingConfiguration = true;
+ updateConfigurationLocked();
} else {
- Intent homeIntent = null;
+ String category = null;
if (mCarModeEnabled) {
if (ENABLE_LAUNCH_CAR_DOCK_APP
- && (enableFlags&UiModeManager.ENABLE_CAR_MODE_GO_CAR_HOME) != 0) {
- homeIntent = buildHomeIntent(Intent.CATEGORY_CAR_DOCK);
+ && (enableFlags & UiModeManager.ENABLE_CAR_MODE_GO_CAR_HOME) != 0) {
+ category = Intent.CATEGORY_CAR_DOCK;
}
} else if (isDeskDockState(mDockState)) {
if (ENABLE_LAUNCH_DESK_DOCK_APP
- && (enableFlags&UiModeManager.ENABLE_CAR_MODE_GO_CAR_HOME) != 0) {
- homeIntent = buildHomeIntent(Intent.CATEGORY_DESK_DOCK);
+ && (enableFlags & UiModeManager.ENABLE_CAR_MODE_GO_CAR_HOME) != 0) {
+ category = Intent.CATEGORY_DESK_DOCK;
}
} else {
- if ((disableFlags&UiModeManager.DISABLE_CAR_MODE_GO_HOME) != 0) {
- homeIntent = buildHomeIntent(Intent.CATEGORY_HOME);
+ if ((disableFlags & UiModeManager.DISABLE_CAR_MODE_GO_HOME) != 0) {
+ category = Intent.CATEGORY_HOME;
}
}
if (LOG) {
Slog.v(TAG, "updateLocked: null action, mDockState="
- + mDockState +", firing homeIntent: " + homeIntent);
+ + mDockState +", category=" + category);
}
- if (homeIntent != null) {
- try {
- mContext.startActivityAsUser(homeIntent, UserHandle.CURRENT);
- } catch (ActivityNotFoundException e) {
- }
- }
+ sendConfigurationAndStartDreamOrDockAppLocked(category);
}
- updateConfigurationLocked(true);
-
// keep screen on when charging and in car mode
boolean keepScreenOn = mCharging &&
((mCarModeEnabled && mCarModeKeepsScreenOn) ||
@@ -487,6 +426,101 @@
}
}
+ private void updateAfterBroadcastLocked(String action, int enableFlags, int disableFlags) {
+ // Launch a dock activity
+ String category = null;
+ if (UiModeManager.ACTION_ENTER_CAR_MODE.equals(action)) {
+ // Only launch car home when car mode is enabled and the caller
+ // has asked us to switch to it.
+ if (ENABLE_LAUNCH_CAR_DOCK_APP
+ && (enableFlags & UiModeManager.ENABLE_CAR_MODE_GO_CAR_HOME) != 0) {
+ category = Intent.CATEGORY_CAR_DOCK;
+ }
+ } else if (UiModeManager.ACTION_ENTER_DESK_MODE.equals(action)) {
+ // Only launch car home when desk mode is enabled and the caller
+ // has asked us to switch to it. Currently re-using the car
+ // mode flag since we don't have a formal API for "desk mode".
+ if (ENABLE_LAUNCH_DESK_DOCK_APP
+ && (enableFlags & UiModeManager.ENABLE_CAR_MODE_GO_CAR_HOME) != 0) {
+ category = Intent.CATEGORY_DESK_DOCK;
+ }
+ } else {
+ // Launch the standard home app if requested.
+ if ((disableFlags & UiModeManager.DISABLE_CAR_MODE_GO_HOME) != 0) {
+ category = Intent.CATEGORY_HOME;
+ }
+ }
+
+ if (LOG) {
+ Slog.v(TAG, String.format(
+ "Handling broadcast result for action %s: enable=0x%08x, disable=0x%08x, "
+ + "category=%s",
+ action, enableFlags, disableFlags, category));
+ }
+
+ sendConfigurationAndStartDreamOrDockAppLocked(category);
+ }
+
+ private void sendConfigurationAndStartDreamOrDockAppLocked(String category) {
+ // Update the configuration but don't send it yet.
+ mHoldingConfiguration = false;
+ updateConfigurationLocked();
+
+ // Start the dock app, if there is one.
+ boolean dockAppStarted = false;
+ if (category != null) {
+ // Now we are going to be careful about switching the
+ // configuration and starting the activity -- we need to
+ // do this in a specific order under control of the
+ // activity manager, to do it cleanly. So compute the
+ // new config, but don't set it yet, and let the
+ // activity manager take care of both the start and config
+ // change.
+ Intent homeIntent = buildHomeIntent(category);
+ try {
+ int result = ActivityManagerNative.getDefault().startActivityWithConfig(
+ null, homeIntent, null, null, null, 0, 0,
+ mConfiguration, null, UserHandle.USER_CURRENT);
+ if (result >= ActivityManager.START_SUCCESS) {
+ dockAppStarted = true;
+ } else if (result != ActivityManager.START_INTENT_NOT_RESOLVED) {
+ Slog.e(TAG, "Could not start dock app: " + homeIntent
+ + ", startActivityWithConfig result " + result);
+ }
+ } catch (RemoteException ex) {
+ Slog.e(TAG, "Could not start dock app: " + homeIntent, ex);
+ }
+ }
+
+ // Send the new configuration.
+ sendConfigurationLocked();
+
+ // If we did not start a dock app, then start dreaming if supported.
+ if (category != null && !dockAppStarted
+ && isScreenSaverEnabled() && isScreenSaverActivatedOnDock()) {
+ Slog.i(TAG, "Activating dream while docked.");
+ try {
+ IDreamManager dreamManagerService = IDreamManager.Stub.asInterface(
+ ServiceManager.getService(Dream.DREAM_SERVICE));
+ dreamManagerService.dream();
+ } catch (RemoteException ex) {
+ Slog.e(TAG, "Could not start dream when docked.", ex);
+ }
+ }
+ }
+
+ private boolean isScreenSaverEnabled() {
+ return Settings.Secure.getIntForUser(mContext.getContentResolver(),
+ Settings.Secure.SCREENSAVER_ENABLED, DEFAULT_SCREENSAVER_ENABLED,
+ UserHandle.USER_CURRENT) != 0;
+ }
+
+ private boolean isScreenSaverActivatedOnDock() {
+ return Settings.Secure.getIntForUser(mContext.getContentResolver(),
+ Settings.Secure.SCREENSAVER_ACTIVATE_ON_DOCK,
+ DEFAULT_SCREENSAVER_ACTIVATED_ON_DOCK, UserHandle.USER_CURRENT) != 0;
+ }
+
private void adjustStatusBarCarModeLocked() {
if (mStatusBarManager == null) {
mStatusBarManager = (StatusBarManager) mContext.getSystemService(Context.STATUS_BAR_SERVICE);
diff --git a/services/java/com/android/server/Watchdog.java b/services/java/com/android/server/Watchdog.java
index 9edfad6..9dbe503 100644
--- a/services/java/com/android/server/Watchdog.java
+++ b/services/java/com/android/server/Watchdog.java
@@ -33,7 +33,6 @@
import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.SystemProperties;
-import android.provider.Settings;
import android.util.EventLog;
import android.util.Log;
import android.util.Slog;
@@ -118,9 +117,7 @@
case MONITOR: {
// See if we should force a reboot.
int rebootInterval = mReqRebootInterval >= 0
- ? mReqRebootInterval : Settings.Secure.getInt(
- mResolver, Settings.Secure.REBOOT_INTERVAL,
- REBOOT_DEFAULT_INTERVAL);
+ ? mReqRebootInterval : REBOOT_DEFAULT_INTERVAL;
if (mRebootInterval != rebootInterval) {
mRebootInterval = rebootInterval;
// We have been running long enough that a reboot can
@@ -226,9 +223,7 @@
void checkReboot(boolean fromAlarm) {
int rebootInterval = mReqRebootInterval >= 0 ? mReqRebootInterval
- : Settings.Secure.getInt(
- mResolver, Settings.Secure.REBOOT_INTERVAL,
- REBOOT_DEFAULT_INTERVAL);
+ : REBOOT_DEFAULT_INTERVAL;
mRebootInterval = rebootInterval;
if (rebootInterval <= 0) {
// No reboot interval requested.
@@ -238,17 +233,11 @@
}
long rebootStartTime = mReqRebootStartTime >= 0 ? mReqRebootStartTime
- : Settings.Secure.getLong(
- mResolver, Settings.Secure.REBOOT_START_TIME,
- REBOOT_DEFAULT_START_TIME);
+ : REBOOT_DEFAULT_START_TIME;
long rebootWindowMillis = (mReqRebootWindow >= 0 ? mReqRebootWindow
- : Settings.Secure.getLong(
- mResolver, Settings.Secure.REBOOT_WINDOW,
- REBOOT_DEFAULT_WINDOW)) * 1000;
+ : REBOOT_DEFAULT_WINDOW) * 1000;
long recheckInterval = (mReqRecheckInterval >= 0 ? mReqRecheckInterval
- : Settings.Secure.getLong(
- mResolver, Settings.Secure.MEMCHECK_RECHECK_INTERVAL,
- MEMCHECK_DEFAULT_RECHECK_INTERVAL)) * 1000;
+ : MEMCHECK_DEFAULT_RECHECK_INTERVAL) * 1000;
retrieveBrutalityAmount();
@@ -325,13 +314,9 @@
*/
void retrieveBrutalityAmount() {
mMinScreenOff = (mReqMinScreenOff >= 0 ? mReqMinScreenOff
- : Settings.Secure.getInt(
- mResolver, Settings.Secure.MEMCHECK_MIN_SCREEN_OFF,
- MEMCHECK_DEFAULT_MIN_SCREEN_OFF)) * 1000;
+ : MEMCHECK_DEFAULT_MIN_SCREEN_OFF) * 1000;
mMinAlarm = (mReqMinNextAlarm >= 0 ? mReqMinNextAlarm
- : Settings.Secure.getInt(
- mResolver, Settings.Secure.MEMCHECK_MIN_ALARM,
- MEMCHECK_DEFAULT_MIN_ALARM)) * 1000;
+ : MEMCHECK_DEFAULT_MIN_ALARM) * 1000;
}
/**
diff --git a/services/java/com/android/server/am/ActiveServices.java b/services/java/com/android/server/am/ActiveServices.java
index 0c0f00c..1269433 100644
--- a/services/java/com/android/server/am/ActiveServices.java
+++ b/services/java/com/android/server/am/ActiveServices.java
@@ -44,7 +44,6 @@
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
-import android.content.pm.UserInfo;
import android.os.Binder;
import android.os.IBinder;
import android.os.Message;
@@ -391,7 +390,7 @@
if (r.isForeground) {
r.isForeground = false;
if (r.app != null) {
- mAm.updateLruProcessLocked(r.app, false, true);
+ mAm.updateLruProcessLocked(r.app, false);
updateServiceForegroundLocked(r.app, true);
}
}
@@ -760,7 +759,8 @@
int N = mPendingServices.size();
for (int i=0; i<N; i++) {
ServiceRecord pr = mPendingServices.get(i);
- if (pr.name.equals(name)) {
+ if (pr.serviceInfo.applicationInfo.uid == sInfo.applicationInfo.uid
+ && pr.name.equals(name)) {
mPendingServices.remove(i);
i--;
N--;
@@ -942,7 +942,7 @@
Slog.w(TAG, "Scheduling restart of crashed service "
+ r.shortName + " in " + r.restartDelay + "ms");
EventLog.writeEvent(EventLogTags.AM_SCHEDULE_SERVICE_RESTART,
- r.shortName, r.restartDelay);
+ r.userId, r.shortName, r.restartDelay);
return canceled;
}
@@ -1083,14 +1083,14 @@
app.services.add(r);
bumpServiceExecutingLocked(r, "create");
- mAm.updateLruProcessLocked(app, true, true);
+ mAm.updateLruProcessLocked(app, true);
boolean created = false;
try {
mAm.mStringBuilder.setLength(0);
r.intent.getIntent().toShortString(mAm.mStringBuilder, true, false, true, false);
EventLog.writeEvent(EventLogTags.AM_CREATE_SERVICE,
- System.identityHashCode(r), r.shortName,
+ r.userId, System.identityHashCode(r), r.shortName,
mAm.mStringBuilder.toString(), r.app.pid);
synchronized (r.stats.getBatteryStats()) {
r.stats.startLaunchedLocked();
@@ -1240,7 +1240,7 @@
if (DEBUG_SERVICE) Slog.v(TAG, "Bringing down " + r + " " + r.intent);
EventLog.writeEvent(EventLogTags.AM_DESTROY_SERVICE,
- System.identityHashCode(r), r.shortName,
+ r.userId, System.identityHashCode(r), r.shortName,
(r.app != null) ? r.app.pid : -1);
mServiceMap.removeServiceByName(r.name, r.userId);
@@ -1664,7 +1664,7 @@
Slog.w(TAG, "Service crashed " + sr.crashCount
+ " times, stopping: " + sr);
EventLog.writeEvent(EventLogTags.AM_SERVICE_CRASHED_TOO_MUCH,
- sr.crashCount, sr.shortName, app.pid);
+ sr.userId, sr.crashCount, sr.shortName, app.pid);
bringDownServiceLocked(sr, true);
} else if (!allowRestart) {
bringDownServiceLocked(sr, true);
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index b266bd4..0221245 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -1369,7 +1369,7 @@
synchronized (mSelf.mPidsSelfLocked) {
mSelf.mPidsSelfLocked.put(app.pid, app);
}
- mSelf.updateLruProcessLocked(app, true, true);
+ mSelf.updateLruProcessLocked(app, true);
}
} catch (PackageManager.NameNotFoundException e) {
throw new RuntimeException(
@@ -1805,8 +1805,7 @@
}
}
- private final void updateLruProcessInternalLocked(ProcessRecord app,
- boolean updateActivityTime, int bestPos) {
+ private final void updateLruProcessInternalLocked(ProcessRecord app, int bestPos) {
// put it on the LRU to keep track of when it should be exited.
int lrui = mLruProcesses.indexOf(app);
if (lrui >= 0) mLruProcesses.remove(lrui);
@@ -1817,9 +1816,7 @@
app.lruSeq = mLruSeq;
// compute the new weight for this process.
- if (updateActivityTime) {
- app.lastActivityTime = SystemClock.uptimeMillis();
- }
+ app.lastActivityTime = SystemClock.uptimeMillis();
if (app.activities.size() > 0) {
// If this process has activities, we more strongly want to keep
// it around.
@@ -1863,24 +1860,22 @@
if (cr.binding != null && cr.binding.service != null
&& cr.binding.service.app != null
&& cr.binding.service.app.lruSeq != mLruSeq) {
- updateLruProcessInternalLocked(cr.binding.service.app,
- updateActivityTime, i+1);
+ updateLruProcessInternalLocked(cr.binding.service.app, i+1);
}
}
}
for (int j=app.conProviders.size()-1; j>=0; j--) {
ContentProviderRecord cpr = app.conProviders.get(j).provider;
if (cpr.proc != null && cpr.proc.lruSeq != mLruSeq) {
- updateLruProcessInternalLocked(cpr.proc,
- updateActivityTime, i+1);
+ updateLruProcessInternalLocked(cpr.proc, i+1);
}
}
}
final void updateLruProcessLocked(ProcessRecord app,
- boolean oomAdj, boolean updateActivityTime) {
+ boolean oomAdj) {
mLruSeq++;
- updateLruProcessInternalLocked(app, updateActivityTime, 0);
+ updateLruProcessInternalLocked(app, 0);
//Slog.i(TAG, "Putting proc to front: " + app.processName);
if (oomAdj) {
@@ -1981,7 +1976,8 @@
+ "/" + info.processName);
mProcessCrashTimes.remove(info.processName, info.uid);
if (mBadProcesses.get(info.processName, info.uid) != null) {
- EventLog.writeEvent(EventLogTags.AM_PROC_GOOD, info.uid,
+ EventLog.writeEvent(EventLogTags.AM_PROC_GOOD,
+ UserHandle.getUserId(info.uid), info.uid,
info.processName);
mBadProcesses.remove(info.processName, info.uid);
if (app != null) {
@@ -2129,7 +2125,8 @@
}
}
- EventLog.writeEvent(EventLogTags.AM_PROC_START, startResult.pid, uid,
+ EventLog.writeEvent(EventLogTags.AM_PROC_START,
+ UserHandle.getUserId(uid), startResult.pid, uid,
app.processName, hostingType,
hostingNameStr != null ? hostingNameStr : "");
@@ -2946,7 +2943,7 @@
if (!r.finishing) {
Slog.w(TAG, "Force removing " + r + ": app died, no saved state");
EventLog.writeEvent(EventLogTags.AM_FINISH_ACTIVITY,
- System.identityHashCode(r),
+ r.userId, System.identityHashCode(r),
r.task.taskId, r.shortComponentName,
"proc died without state saved");
}
@@ -3037,7 +3034,7 @@
Slog.i(TAG, "Process " + app.processName + " (pid " + pid
+ ") has died.");
}
- EventLog.writeEvent(EventLogTags.AM_PROC_DIED, app.pid, app.processName);
+ EventLog.writeEvent(EventLogTags.AM_PROC_DIED, app.userId, app.pid, app.processName);
if (localLOGV) Slog.v(
TAG, "Dying app: " + app + ", pid: " + pid
+ ", thread: " + thread.asBinder());
@@ -3086,7 +3083,7 @@
// A new process has already been started.
Slog.i(TAG, "Process " + app.processName + " (pid " + pid
+ ") has died and restarted (pid " + app.pid + ").");
- EventLog.writeEvent(EventLogTags.AM_PROC_DIED, app.pid, app.processName);
+ EventLog.writeEvent(EventLogTags.AM_PROC_DIED, app.userId, app.pid, app.processName);
} else if (DEBUG_PROCESSES) {
Slog.d(TAG, "Received spurious death notification for thread "
+ thread.asBinder());
@@ -3321,8 +3318,8 @@
app.notResponding = true;
// Log the ANR to the event log.
- EventLog.writeEvent(EventLogTags.AM_ANR, app.pid, app.processName, app.info.flags,
- annotation);
+ EventLog.writeEvent(EventLogTags.AM_ANR, app.userId, app.pid,
+ app.processName, app.info.flags, annotation);
// Dump thread traces as quickly as we can, starting with "interesting" processes.
firstPids.add(app.pid);
@@ -3408,7 +3405,7 @@
synchronized (this) {
if (!showBackground && !app.isInterestingToUserLocked() && app.pid != MY_PID) {
Slog.w(TAG, "Killing " + app + ": background ANR");
- EventLog.writeEvent(EventLogTags.AM_KILL, app.pid,
+ EventLog.writeEvent(EventLogTags.AM_KILL, app.userId, app.pid,
app.processName, app.setAdj, "background ANR");
Process.killProcessQuiet(app.pid);
return;
@@ -4077,8 +4074,8 @@
if (gone) {
Slog.w(TAG, "Process " + app + " failed to attach");
- EventLog.writeEvent(EventLogTags.AM_PROCESS_START_TIMEOUT, pid, app.uid,
- app.processName);
+ EventLog.writeEvent(EventLogTags.AM_PROCESS_START_TIMEOUT, app.userId,
+ pid, app.uid, app.processName);
mProcessNames.remove(app.processName, app.uid);
mIsolatedProcesses.remove(app.uid);
if (mHeavyWeightProcess == app) {
@@ -4090,7 +4087,7 @@
checkAppInLaunchingProvidersLocked(app, true);
// Take care of any services that are waiting for the process.
mServices.processStartTimedOutLocked(app);
- EventLog.writeEvent(EventLogTags.AM_KILL, pid,
+ EventLog.writeEvent(EventLogTags.AM_KILL, app.userId, pid,
app.processName, app.setAdj, "start timeout");
Process.killProcessQuiet(pid);
if (mBackupTarget != null && mBackupTarget.app.pid == pid) {
@@ -4166,7 +4163,7 @@
return false;
}
- EventLog.writeEvent(EventLogTags.AM_PROC_BOUND, app.pid, app.processName);
+ EventLog.writeEvent(EventLogTags.AM_PROC_BOUND, app.userId, app.pid, app.processName);
app.thread = thread;
app.curAdj = app.setAdj = -100;
@@ -4244,7 +4241,7 @@
enableOpenGlTrace, isRestrictedBackupMode || !normalMode, app.persistent,
new Configuration(mConfiguration), app.compat, getCommonServicesLocked(),
mCoreSettingsObserver.getCoreSettingsLocked());
- updateLruProcessLocked(app, false, true);
+ updateLruProcessLocked(app, false);
app.lastRequestedGc = app.lastLowMemory = SystemClock.uptimeMillis();
} catch (Exception e) {
// todo: Yikes! What should we do? For now we will try to
@@ -5914,7 +5911,7 @@
ProcessRecord pr = procs.get(i);
if (pr.setSchedGroup == Process.THREAD_GROUP_BG_NONINTERACTIVE) {
Slog.i(TAG, "Killing " + pr.toShortString() + ": remove task");
- EventLog.writeEvent(EventLogTags.AM_KILL, pr.pid,
+ EventLog.writeEvent(EventLogTags.AM_KILL, pr.userId, pr.pid,
pr.processName, pr.setAdj, "remove task");
pr.killedBackground = true;
Process.killProcessQuiet(pr.pid);
@@ -6442,7 +6439,7 @@
// make sure to count it as being accessed and thus
// back up on the LRU list. This is good because
// content providers are often expensive to start.
- updateLruProcessLocked(cpr.proc, false, true);
+ updateLruProcessLocked(cpr.proc, false);
}
}
@@ -6630,6 +6627,7 @@
+ cpi.applicationInfo.uid + " for provider "
+ name + ": launching app became null");
EventLog.writeEvent(EventLogTags.AM_PROVIDER_LOST_PROCESS,
+ UserHandle.getUserId(cpi.applicationInfo.uid),
cpi.applicationInfo.packageName,
cpi.applicationInfo.uid, name);
return null;
@@ -7013,7 +7011,7 @@
if (isolated) {
mIsolatedProcesses.put(app.uid, app);
}
- updateLruProcessLocked(app, true, true);
+ updateLruProcessLocked(app, true);
}
// This package really, really can not be stopped.
@@ -7499,7 +7497,7 @@
int adj = proc.setAdj;
if (adj >= worstType && !proc.killedBackground) {
Slog.w(TAG, "Killing " + proc + " (adj " + adj + "): " + reason);
- EventLog.writeEvent(EventLogTags.AM_KILL, proc.pid,
+ EventLog.writeEvent(EventLogTags.AM_KILL, proc.userId, proc.pid,
proc.processName, adj, reason);
killed = true;
proc.killedBackground = true;
@@ -7535,8 +7533,8 @@
final int adj = proc.setAdj;
if (adj > belowAdj && !proc.killedBackground) {
Slog.w(TAG, "Killing " + proc + " (adj " + adj + "): " + reason);
- EventLog.writeEvent(
- EventLogTags.AM_KILL, proc.pid, proc.processName, adj, reason);
+ EventLog.writeEvent(EventLogTags.AM_KILL, proc.userId,
+ proc.pid, proc.processName, adj, reason);
killed = true;
proc.killedBackground = true;
Process.killProcessQuiet(pid);
@@ -7953,7 +7951,7 @@
if (app.pid > 0 && app.pid != MY_PID) {
handleAppCrashLocked(app);
Slog.i(ActivityManagerService.TAG, "Killing " + app + ": user's request");
- EventLog.writeEvent(EventLogTags.AM_KILL, app.pid,
+ EventLog.writeEvent(EventLogTags.AM_KILL, app.userId, app.pid,
app.processName, app.setAdj, "user's request after error");
Process.killProcessQuiet(app.pid);
}
@@ -7978,7 +7976,7 @@
Slog.w(TAG, "Process " + app.info.processName
+ " has crashed too many times: killing!");
EventLog.writeEvent(EventLogTags.AM_PROCESS_CRASHED_TOO_MUCH,
- app.info.processName, app.uid);
+ app.userId, app.info.processName, app.uid);
for (int i=mMainStack.mHistory.size()-1; i>=0; i--) {
ActivityRecord r = (ActivityRecord)mMainStack.mHistory.get(i);
if (r.app == app) {
@@ -7993,7 +7991,7 @@
// explicitly does so... but for persistent process, we really
// need to keep it running. If a persistent process is actually
// repeatedly crashing, then badness for everyone.
- EventLog.writeEvent(EventLogTags.AM_PROC_BAD, app.uid,
+ EventLog.writeEvent(EventLogTags.AM_PROC_BAD, app.userId, app.uid,
app.info.processName);
if (!app.isolated) {
// XXX We don't have a way to mark isolated processes
@@ -8106,7 +8104,7 @@
: (r == null ? "unknown" : r.processName);
EventLog.writeEvent(EventLogTags.AM_CRASH, Binder.getCallingPid(),
- processName,
+ UserHandle.getUserId(Binder.getCallingUid()), processName,
r == null ? -1 : r.info.flags,
crashInfo.exceptionClassName,
crashInfo.exceptionMessage,
@@ -8304,7 +8302,8 @@
final String processName = app == null ? "system_server"
: (r == null ? "unknown" : r.processName);
- EventLog.writeEvent(EventLogTags.AM_WTF, Binder.getCallingPid(),
+ EventLog.writeEvent(EventLogTags.AM_WTF,
+ UserHandle.getUserId(Binder.getCallingUid()), Binder.getCallingPid(),
processName,
r == null ? -1 : r.info.flags,
tag, crashInfo.exceptionMessage);
@@ -10067,6 +10066,7 @@
pw.print(" ");
pw.print("oom: max="); pw.print(r.maxAdj);
pw.print(" hidden="); pw.print(r.hiddenAdj);
+ pw.print(" client="); pw.print(r.clientHiddenAdj);
pw.print(" empty="); pw.print(r.emptyAdj);
pw.print(" curRaw="); pw.print(r.curRawAdj);
pw.print(" setRaw="); pw.print(r.setRawAdj);
@@ -10591,7 +10591,7 @@
Slog.i(TAG, "Kill " + capp.processName
+ " (pid " + capp.pid + "): provider " + cpr.info.name
+ " in dying process " + (proc != null ? proc.processName : "??"));
- EventLog.writeEvent(EventLogTags.AM_KILL, capp.pid,
+ EventLog.writeEvent(EventLogTags.AM_KILL, capp.userId, capp.pid,
capp.processName, capp.setAdj, "dying provider "
+ cpr.name.toShortString());
Process.killProcessQuiet(capp.pid);
@@ -11514,8 +11514,9 @@
* Prevent non-system code (defined here to be non-persistent
* processes) from sending protected broadcasts.
*/
- if (callingUid == Process.SYSTEM_UID || callingUid == Process.PHONE_UID
- || callingUid == Process.SHELL_UID || callingUid == Process.BLUETOOTH_UID ||
+ int callingAppId = UserHandle.getAppId(callingUid);
+ if (callingAppId == Process.SYSTEM_UID || callingAppId == Process.PHONE_UID
+ || callingAppId == Process.SHELL_UID || callingAppId == Process.BLUETOOTH_UID ||
callingUid == 0) {
// Always okay.
} else if (callerApp == null || !callerApp.persistent) {
@@ -12466,7 +12467,7 @@
return null;
}
- private final int computeOomAdjLocked(ProcessRecord app, int hiddenAdj,
+ private final int computeOomAdjLocked(ProcessRecord app, int hiddenAdj, int clientHiddenAdj,
int emptyAdj, ProcessRecord TOP_APP, boolean recursed, boolean doingAll) {
if (mAdjSeq == app.adjSeq) {
// This adjustment has already been computed. If we are calling
@@ -12474,8 +12475,13 @@
// an earlier hidden adjustment that isn't really for us... if
// so, use the new hidden adjustment.
if (!recursed && app.hidden) {
- app.curAdj = app.curRawAdj = app.nonStoppingAdj =
- app.hasActivities ? hiddenAdj : emptyAdj;
+ if (app.hasActivities) {
+ app.curAdj = app.curRawAdj = app.nonStoppingAdj = hiddenAdj;
+ } else if (app.hasClientActivities) {
+ app.curAdj = app.curRawAdj = app.nonStoppingAdj = clientHiddenAdj;
+ } else {
+ app.curAdj = app.curRawAdj = app.nonStoppingAdj = emptyAdj;
+ }
}
return app.curRawAdj;
}
@@ -12491,6 +12497,7 @@
app.adjTarget = null;
app.empty = false;
app.hidden = false;
+ app.hasClientActivities = false;
final int activitiesSize = app.activities.size();
@@ -12572,7 +12579,7 @@
adj = hiddenAdj;
schedGroup = Process.THREAD_GROUP_BG_NONINTERACTIVE;
app.hidden = true;
- app.adjType = "bg-activities";
+ app.adjType = "bg-act";
}
boolean hasStoppingActivities = false;
@@ -12614,11 +12621,16 @@
}
if (adj == hiddenAdj && !app.hasActivities) {
- // Whoops, this process is completely empty as far as we know
- // at this point.
- adj = emptyAdj;
- app.empty = true;
- app.adjType = "bg-empty";
+ if (app.hasClientActivities) {
+ adj = clientHiddenAdj;
+ app.adjType = "bg-client-act";
+ } else {
+ // Whoops, this process is completely empty as far as we know
+ // at this point.
+ adj = emptyAdj;
+ app.empty = true;
+ app.adjType = "bg-empty";
+ }
}
if (adj > ProcessList.PERCEPTIBLE_APP_ADJ) {
@@ -12626,13 +12638,13 @@
// The user is aware of this app, so make it visible.
adj = ProcessList.PERCEPTIBLE_APP_ADJ;
app.hidden = false;
- app.adjType = "foreground-service";
+ app.adjType = "fg-service";
schedGroup = Process.THREAD_GROUP_DEFAULT;
} else if (app.forcingToForeground != null) {
// The user is aware of this app, so make it visible.
adj = ProcessList.PERCEPTIBLE_APP_ADJ;
app.hidden = false;
- app.adjType = "force-foreground";
+ app.adjType = "force-fg";
app.adjSource = app.forcingToForeground;
schedGroup = Process.THREAD_GROUP_DEFAULT;
}
@@ -12754,6 +12766,14 @@
myHiddenAdj = ProcessList.VISIBLE_APP_ADJ;
}
}
+ int myClientHiddenAdj = clientHiddenAdj;
+ if (myClientHiddenAdj > client.clientHiddenAdj) {
+ if (client.clientHiddenAdj >= ProcessList.VISIBLE_APP_ADJ) {
+ myClientHiddenAdj = client.clientHiddenAdj;
+ } else {
+ myClientHiddenAdj = ProcessList.VISIBLE_APP_ADJ;
+ }
+ }
int myEmptyAdj = emptyAdj;
if (myEmptyAdj > client.emptyAdj) {
if (client.emptyAdj >= ProcessList.VISIBLE_APP_ADJ) {
@@ -12763,7 +12783,7 @@
}
}
clientAdj = computeOomAdjLocked(client, myHiddenAdj,
- myEmptyAdj, TOP_APP, true, doingAll);
+ myClientHiddenAdj, myEmptyAdj, TOP_APP, true, doingAll);
String adjType = null;
if ((cr.flags&Context.BIND_ALLOW_OOM_MANAGEMENT) != 0) {
// Not doing bind OOM management, so treat
@@ -12792,6 +12812,19 @@
clientAdj = adj;
}
}
+ } else if ((cr.flags&Context.BIND_AUTO_CREATE) != 0) {
+ if ((cr.flags&Context.BIND_NOT_VISIBLE) == 0) {
+ // If this connection is keeping the service
+ // created, then we want to try to better follow
+ // its memory management semantics for activities.
+ // That is, if it is sitting in the background
+ // LRU list as a hidden process (with activities),
+ // we don't want the service it is connected to
+ // to go into the empty LRU and quickly get killed,
+ // because I'll we'll do is just end up restarting
+ // the service.
+ app.hasClientActivities |= client.hasActivities;
+ }
}
if (adj > clientAdj) {
// If this process has recently shown UI, and
@@ -12843,8 +12876,8 @@
}
}
}
+ final ActivityRecord a = cr.activity;
if ((cr.flags&Context.BIND_ADJUST_WITH_ACTIVITY) != 0) {
- ActivityRecord a = cr.activity;
if (a != null && adj > ProcessList.FOREGROUND_APP_ADJ &&
(a.visible || a.state == ActivityState.RESUMED
|| a.state == ActivityState.PAUSING)) {
@@ -12902,6 +12935,14 @@
myHiddenAdj = ProcessList.FOREGROUND_APP_ADJ;
}
}
+ int myClientHiddenAdj = clientHiddenAdj;
+ if (myClientHiddenAdj > client.clientHiddenAdj) {
+ if (client.clientHiddenAdj >= ProcessList.FOREGROUND_APP_ADJ) {
+ myClientHiddenAdj = client.clientHiddenAdj;
+ } else {
+ myClientHiddenAdj = ProcessList.FOREGROUND_APP_ADJ;
+ }
+ }
int myEmptyAdj = emptyAdj;
if (myEmptyAdj > client.emptyAdj) {
if (client.emptyAdj > ProcessList.FOREGROUND_APP_ADJ) {
@@ -12911,7 +12952,7 @@
}
}
int clientAdj = computeOomAdjLocked(client, myHiddenAdj,
- myEmptyAdj, TOP_APP, true, doingAll);
+ myClientHiddenAdj, myEmptyAdj, TOP_APP, true, doingAll);
if (adj > clientAdj) {
if (app.hasShownUi && app != mHomeProcess
&& clientAdj > ProcessList.PERCEPTIBLE_APP_ADJ) {
@@ -13301,7 +13342,7 @@
Slog.w(TAG, "Excessive wake lock in " + app.processName
+ " (pid " + app.pid + "): held " + wtimeUsed
+ " during " + realtimeSince);
- EventLog.writeEvent(EventLogTags.AM_KILL, app.pid,
+ EventLog.writeEvent(EventLogTags.AM_KILL, app.userId, app.pid,
app.processName, app.setAdj, "excessive wake lock");
Process.killProcessQuiet(app.pid);
} else if (doCpuKills && uptimeSince > 0
@@ -13313,7 +13354,7 @@
Slog.w(TAG, "Excessive CPU in " + app.processName
+ " (pid " + app.pid + "): used " + cputimeUsed
+ " during " + uptimeSince);
- EventLog.writeEvent(EventLogTags.AM_KILL, app.pid,
+ EventLog.writeEvent(EventLogTags.AM_KILL, app.userId, app.pid,
app.processName, app.setAdj, "excessive cpu");
Process.killProcessQuiet(app.pid);
} else {
@@ -13325,8 +13366,9 @@
}
private final boolean updateOomAdjLocked(ProcessRecord app, int hiddenAdj,
- int emptyAdj, ProcessRecord TOP_APP, boolean doingAll) {
+ int clientHiddenAdj, int emptyAdj, ProcessRecord TOP_APP, boolean doingAll) {
app.hiddenAdj = hiddenAdj;
+ app.clientHiddenAdj = clientHiddenAdj;
app.emptyAdj = emptyAdj;
if (app.thread == null) {
@@ -13337,7 +13379,7 @@
boolean success = true;
- computeOomAdjLocked(app, hiddenAdj, emptyAdj, TOP_APP, false, doingAll);
+ computeOomAdjLocked(app, hiddenAdj, clientHiddenAdj, emptyAdj, TOP_APP, false, doingAll);
if (app.curRawAdj != app.setRawAdj) {
if (wasKeeping && !app.keeping) {
@@ -13374,7 +13416,7 @@
if (app.waitingToKill != null &&
app.setSchedGroup == Process.THREAD_GROUP_BG_NONINTERACTIVE) {
Slog.i(TAG, "Killing " + app.toShortString() + ": " + app.waitingToKill);
- EventLog.writeEvent(EventLogTags.AM_KILL, app.pid,
+ EventLog.writeEvent(EventLogTags.AM_KILL, app.userId, app.pid,
app.processName, app.setAdj, app.waitingToKill);
app.killedBackground = true;
Process.killProcessQuiet(app.pid);
@@ -13424,8 +13466,8 @@
mAdjSeq++;
- boolean success = updateOomAdjLocked(app, app.hiddenAdj, app.emptyAdj,
- TOP_APP, false);
+ boolean success = updateOomAdjLocked(app, app.hiddenAdj, app.clientHiddenAdj,
+ app.emptyAdj, TOP_APP, false);
final boolean nowHidden = app.curAdj >= ProcessList.HIDDEN_APP_MIN_ADJ
&& app.curAdj <= ProcessList.HIDDEN_APP_MAX_ADJ;
if (nowHidden != wasHidden) {
@@ -13439,6 +13481,7 @@
final void updateOomAdjLocked() {
final ActivityRecord TOP_ACT = resumedAppLocked();
final ProcessRecord TOP_APP = TOP_ACT != null ? TOP_ACT.app : null;
+ final long oldTime = SystemClock.uptimeMillis() - ProcessList.MAX_EMPTY_TIME;
if (false) {
RuntimeException e = new RuntimeException();
@@ -13449,20 +13492,40 @@
mAdjSeq++;
mNewNumServiceProcs = 0;
+ final int emptyProcessLimit;
+ final int hiddenProcessLimit;
+ if (mProcessLimit <= 0) {
+ emptyProcessLimit = hiddenProcessLimit = 0;
+ } else if (mProcessLimit == 1) {
+ emptyProcessLimit = 1;
+ hiddenProcessLimit = 0;
+ } else {
+ emptyProcessLimit = (mProcessLimit*2)/3;
+ hiddenProcessLimit = mProcessLimit - emptyProcessLimit;
+ }
+
// Let's determine how many processes we have running vs.
// how many slots we have for background processes; we may want
// to put multiple processes in a slot of there are enough of
// them.
int numSlots = (ProcessList.HIDDEN_APP_MAX_ADJ
- ProcessList.HIDDEN_APP_MIN_ADJ + 1) / 2;
- int emptyFactor = (mLruProcesses.size()-mNumNonHiddenProcs-mNumHiddenProcs)/numSlots;
+ int numEmptyProcs = mLruProcesses.size()-mNumNonHiddenProcs-mNumHiddenProcs;
+ if (numEmptyProcs > hiddenProcessLimit) {
+ // If there are more empty processes than our limit on hidden
+ // processes, then use the hidden process limit for the factor.
+ // This ensures that the really old empty processes get pushed
+ // down to the bottom, so if we are running low on memory we will
+ // have a better chance at keeping around more hidden processes
+ // instead of a gazillion empty processes.
+ numEmptyProcs = hiddenProcessLimit;
+ }
+ int emptyFactor = numEmptyProcs/numSlots;
if (emptyFactor < 1) emptyFactor = 1;
int hiddenFactor = (mNumHiddenProcs > 0 ? mNumHiddenProcs : 1)/numSlots;
if (hiddenFactor < 1) hiddenFactor = 1;
int stepHidden = 0;
int stepEmpty = 0;
- final int emptyProcessLimit = mProcessLimit > 1 ? mProcessLimit / 2 : mProcessLimit;
- final int hiddenProcessLimit = mProcessLimit > 1 ? mProcessLimit / 2 : mProcessLimit;
int numHidden = 0;
int numEmpty = 0;
int numTrimming = 0;
@@ -13477,11 +13540,12 @@
int nextHiddenAdj = curHiddenAdj+1;
int curEmptyAdj = ProcessList.HIDDEN_APP_MIN_ADJ;
int nextEmptyAdj = curEmptyAdj+2;
+ int curClientHiddenAdj = curEmptyAdj;
while (i > 0) {
i--;
ProcessRecord app = mLruProcesses.get(i);
//Slog.i(TAG, "OOM " + app + ": cur hidden=" + curHiddenAdj);
- updateOomAdjLocked(app, curHiddenAdj, curEmptyAdj, TOP_APP, true);
+ updateOomAdjLocked(app, curHiddenAdj, curClientHiddenAdj, curEmptyAdj, TOP_APP, true);
if (!app.killedBackground) {
if (app.curRawAdj == curHiddenAdj && app.hasActivities) {
// This process was assigned as a hidden process... step the
@@ -13496,17 +13560,31 @@
if (nextHiddenAdj > ProcessList.HIDDEN_APP_MAX_ADJ) {
nextHiddenAdj = ProcessList.HIDDEN_APP_MAX_ADJ;
}
+ if (curClientHiddenAdj <= curHiddenAdj) {
+ curClientHiddenAdj = curHiddenAdj + 1;
+ if (curClientHiddenAdj > ProcessList.HIDDEN_APP_MAX_ADJ) {
+ curClientHiddenAdj = ProcessList.HIDDEN_APP_MAX_ADJ;
+ }
+ }
}
}
numHidden++;
if (numHidden > hiddenProcessLimit) {
Slog.i(TAG, "No longer want " + app.processName
+ " (pid " + app.pid + "): hidden #" + numHidden);
- EventLog.writeEvent(EventLogTags.AM_KILL, app.pid,
+ EventLog.writeEvent(EventLogTags.AM_KILL, app.userId, app.pid,
app.processName, app.setAdj, "too many background");
app.killedBackground = true;
Process.killProcessQuiet(app.pid);
}
+ } else if (app.curRawAdj == curHiddenAdj && app.hasClientActivities) {
+ // This process has a client that has activities. We will have
+ // given it the current hidden adj; here we will just leave it
+ // without stepping the hidden adj.
+ curClientHiddenAdj++;
+ if (curClientHiddenAdj > ProcessList.HIDDEN_APP_MAX_ADJ) {
+ curClientHiddenAdj = ProcessList.HIDDEN_APP_MAX_ADJ;
+ }
} else {
if (app.curRawAdj == curEmptyAdj || app.curRawAdj == curHiddenAdj) {
// This process was assigned as an empty process... step the
@@ -13525,15 +13603,28 @@
} else if (app.curRawAdj < ProcessList.HIDDEN_APP_MIN_ADJ) {
mNumNonHiddenProcs++;
}
- if (app.curAdj >= ProcessList.HIDDEN_APP_MIN_ADJ) {
- numEmpty++;
- if (numEmpty > emptyProcessLimit) {
+ if (app.curAdj >= ProcessList.HIDDEN_APP_MIN_ADJ
+ && !app.hasClientActivities) {
+ if (numEmpty > ProcessList.TRIM_EMPTY_APPS
+ && app.lastActivityTime < oldTime) {
Slog.i(TAG, "No longer want " + app.processName
- + " (pid " + app.pid + "): empty #" + numEmpty);
- EventLog.writeEvent(EventLogTags.AM_KILL, app.pid,
- app.processName, app.setAdj, "too many background");
+ + " (pid " + app.pid + "): empty for "
+ + ((oldTime+ProcessList.MAX_EMPTY_TIME-app.lastActivityTime)
+ / 1000) + "s");
+ EventLog.writeEvent(EventLogTags.AM_KILL, app.userId, app.pid,
+ app.processName, app.setAdj, "old background process");
app.killedBackground = true;
Process.killProcessQuiet(app.pid);
+ } else {
+ numEmpty++;
+ if (numEmpty > emptyProcessLimit) {
+ Slog.i(TAG, "No longer want " + app.processName
+ + " (pid " + app.pid + "): empty #" + numEmpty);
+ EventLog.writeEvent(EventLogTags.AM_KILL, app.userId, app.pid,
+ app.processName, app.setAdj, "too many background");
+ app.killedBackground = true;
+ Process.killProcessQuiet(app.pid);
+ }
}
}
}
@@ -13546,7 +13637,7 @@
// left sitting around after no longer needed.
Slog.i(TAG, "Isolated process " + app.processName
+ " (pid " + app.pid + ") no longer needed");
- EventLog.writeEvent(EventLogTags.AM_KILL, app.pid,
+ EventLog.writeEvent(EventLogTags.AM_KILL, app.userId, app.pid,
app.processName, app.setAdj, "isolated not needed");
app.killedBackground = true;
Process.killProcessQuiet(app.pid);
@@ -13567,8 +13658,8 @@
// are managing to keep around is less than half the maximum we desire;
// if we are keeping a good number around, we'll let them use whatever
// memory they want.
- if (numHidden <= (ProcessList.MAX_HIDDEN_APPS/4)
- && numEmpty <= (ProcessList.MAX_HIDDEN_APPS/4)) {
+ if (numHidden <= ProcessList.TRIM_HIDDEN_APPS
+ && numEmpty <= ProcessList.TRIM_EMPTY_APPS) {
final int numHiddenAndEmpty = numHidden + numEmpty;
final int N = mLruProcesses.size();
int factor = numTrimming/3;
@@ -13578,9 +13669,9 @@
if (factor < minFactor) factor = minFactor;
int step = 0;
int fgTrimLevel;
- if (numHiddenAndEmpty <= (ProcessList.MAX_HIDDEN_APPS/5)) {
+ if (numHiddenAndEmpty <= ProcessList.TRIM_CRITICAL_THRESHOLD) {
fgTrimLevel = ComponentCallbacks2.TRIM_MEMORY_RUNNING_CRITICAL;
- } else if (numHiddenAndEmpty <= (ProcessList.MAX_HIDDEN_APPS/3)) {
+ } else if (numHiddenAndEmpty <= ProcessList.TRIM_LOW_THRESHOLD) {
fgTrimLevel = ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW;
} else {
fgTrimLevel = ComponentCallbacks2.TRIM_MEMORY_RUNNING_MODERATE;
@@ -13700,7 +13791,7 @@
+ (app.thread != null ? app.thread.asBinder() : null)
+ ")\n");
if (app.pid > 0 && app.pid != MY_PID) {
- EventLog.writeEvent(EventLogTags.AM_KILL, app.pid,
+ EventLog.writeEvent(EventLogTags.AM_KILL, app.userId, app.pid,
app.processName, app.setAdj, "empty");
Process.killProcessQuiet(app.pid);
} else {
diff --git a/services/java/com/android/server/am/ActivityRecord.java b/services/java/com/android/server/am/ActivityRecord.java
index 7ff5748..6cd86fd 100644
--- a/services/java/com/android/server/am/ActivityRecord.java
+++ b/services/java/com/android/server/am/ActivityRecord.java
@@ -746,8 +746,8 @@
final long totalTime = stack.mInitialStartTime != 0
? (curTime - stack.mInitialStartTime) : thisTime;
if (ActivityManagerService.SHOW_ACTIVITY_START_TIME) {
- EventLog.writeEvent(EventLogTags.ACTIVITY_LAUNCH_TIME,
- System.identityHashCode(this), shortComponentName,
+ EventLog.writeEvent(EventLogTags.AM_ACTIVITY_LAUNCH_TIME,
+ userId, System.identityHashCode(this), shortComponentName,
thisTime, totalTime);
StringBuilder sb = service.mStringBuilder;
sb.setLength(0);
@@ -923,6 +923,8 @@
StringBuilder sb = new StringBuilder(128);
sb.append("ActivityRecord{");
sb.append(Integer.toHexString(System.identityHashCode(this)));
+ sb.append(" u");
+ sb.append(userId);
sb.append(' ');
sb.append(intent.getComponent().flattenToShortString());
sb.append('}');
diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java
index 1707ff0..2d445274 100755
--- a/services/java/com/android/server/am/ActivityStack.java
+++ b/services/java/com/android/server/am/ActivityStack.java
@@ -638,7 +638,7 @@
if (idx < 0) {
app.activities.add(r);
}
- mService.updateLruProcessLocked(app, true, true);
+ mService.updateLruProcessLocked(app, true);
try {
if (app.thread == null) {
@@ -656,7 +656,7 @@
+ " andResume=" + andResume);
if (andResume) {
EventLog.writeEvent(EventLogTags.AM_RESTART_ACTIVITY,
- System.identityHashCode(r),
+ r.userId, System.identityHashCode(r),
r.task.taskId, r.shortComponentName);
}
if (r.isHomeActivity) {
@@ -951,7 +951,7 @@
if (DEBUG_PAUSE) Slog.v(TAG, "Enqueueing pending pause: " + prev);
try {
EventLog.writeEvent(EventLogTags.AM_PAUSE_ACTIVITY,
- System.identityHashCode(prev),
+ prev.userId, System.identityHashCode(prev),
prev.shortComponentName);
prev.app.thread.schedulePauseActivity(prev.appToken, prev.finishing,
userLeaving, prev.configChangeFlags);
@@ -1040,7 +1040,7 @@
completePauseLocked();
} else {
EventLog.writeEvent(EventLogTags.AM_FAILED_TO_PAUSE,
- System.identityHashCode(r), r.shortComponentName,
+ r.userId, System.identityHashCode(r), r.shortComponentName,
mPausingActivity != null
? mPausingActivity.shortComponentName : "(none)");
}
@@ -1505,7 +1505,7 @@
if (next.app != null && next.app.thread != null) {
// No reason to do full oom adj update here; we'll let that
// happen whenever it needs to later.
- mService.updateLruProcessLocked(next.app, false, true);
+ mService.updateLruProcessLocked(next.app, false);
}
startPausingLocked(userLeaving, false);
return true;
@@ -1641,7 +1641,7 @@
if (mMainStack) {
mService.addRecentTaskLocked(next.task);
}
- mService.updateLruProcessLocked(next.app, true, true);
+ mService.updateLruProcessLocked(next.app, true);
updateLRUListLocked(next);
// Have the window manager re-evaluate the orientation of
@@ -1699,7 +1699,7 @@
}
EventLog.writeEvent(EventLogTags.AM_RESUME_ACTIVITY,
- System.identityHashCode(next),
+ next.userId, System.identityHashCode(next),
next.task.taskId, next.shortComponentName);
next.sleeping = false;
@@ -2967,7 +2967,7 @@
intent, r.getUriPermissionsLocked());
if (newTask) {
- EventLog.writeEvent(EventLogTags.AM_CREATE_TASK, r.task.taskId);
+ EventLog.writeEvent(EventLogTags.AM_CREATE_TASK, r.userId, r.task.taskId);
}
logStartActivity(EventLogTags.AM_CREATE_ACTIVITY, r, r.task);
startActivityLocked(r, newTask, doResume, keepCurTransition, options);
@@ -3700,7 +3700,7 @@
r.makeFinishing();
EventLog.writeEvent(EventLogTags.AM_FINISH_ACTIVITY,
- System.identityHashCode(r),
+ r.userId, System.identityHashCode(r),
r.task.taskId, r.shortComponentName, reason);
if (index < (mHistory.size()-1)) {
ActivityRecord next = mHistory.get(index+1);
@@ -3996,7 +3996,7 @@
TAG, "Removing activity from " + reason + ": token=" + r
+ ", app=" + (r.app != null ? r.app.processName : "(null)"));
EventLog.writeEvent(EventLogTags.AM_DESTROY_ACTIVITY,
- System.identityHashCode(r),
+ r.userId, System.identityHashCode(r),
r.task.taskId, r.shortComponentName, reason);
boolean removedFromHistory = false;
@@ -4228,7 +4228,7 @@
}
finishTaskMoveLocked(task);
- EventLog.writeEvent(EventLogTags.AM_TASK_TO_FRONT, task);
+ EventLog.writeEvent(EventLogTags.AM_TASK_TO_FRONT, tr.userId, task);
}
private final void finishTaskMoveLocked(int task) {
@@ -4448,7 +4448,7 @@
private final void logStartActivity(int tag, ActivityRecord r,
TaskRecord task) {
EventLog.writeEvent(tag,
- System.identityHashCode(r), task.taskId,
+ r.userId, System.identityHashCode(r), task.taskId,
r.shortComponentName, r.intent.getAction(),
r.intent.getType(), r.intent.getDataString(),
r.intent.getFlags());
@@ -4590,7 +4590,7 @@
+ " with results=" + results + " newIntents=" + newIntents
+ " andResume=" + andResume);
EventLog.writeEvent(andResume ? EventLogTags.AM_RELAUNCH_RESUME_ACTIVITY
- : EventLogTags.AM_RELAUNCH_ACTIVITY, System.identityHashCode(r),
+ : EventLogTags.AM_RELAUNCH_ACTIVITY, r.userId, System.identityHashCode(r),
r.task.taskId, r.shortComponentName);
r.startFreezingScreenLocked(r.app, 0);
diff --git a/services/java/com/android/server/am/BroadcastFilter.java b/services/java/com/android/server/am/BroadcastFilter.java
index 07440b5..c631b6e 100644
--- a/services/java/com/android/server/am/BroadcastFilter.java
+++ b/services/java/com/android/server/am/BroadcastFilter.java
@@ -64,6 +64,8 @@
StringBuilder sb = new StringBuilder();
sb.append("BroadcastFilter{");
sb.append(Integer.toHexString(System.identityHashCode(this)));
+ sb.append(" u");
+ sb.append(owningUserId);
sb.append(' ');
sb.append(receiverList);
sb.append('}');
diff --git a/services/java/com/android/server/am/BroadcastQueue.java b/services/java/com/android/server/am/BroadcastQueue.java
index b0af081..9f27994 100644
--- a/services/java/com/android/server/am/BroadcastQueue.java
+++ b/services/java/com/android/server/am/BroadcastQueue.java
@@ -209,7 +209,7 @@
r.receiver = app.thread.asBinder();
r.curApp = app;
app.curReceiver = r;
- mService.updateLruProcessLocked(app, true, true);
+ mService.updateLruProcessLocked(app, true);
// Tell the application to launch this receiver.
r.intent.setComponent(r.curComponent);
@@ -930,22 +930,22 @@
if (curReceiver instanceof BroadcastFilter) {
BroadcastFilter bf = (BroadcastFilter) curReceiver;
EventLog.writeEvent(EventLogTags.AM_BROADCAST_DISCARD_FILTER,
- System.identityHashCode(r),
+ bf.owningUserId, System.identityHashCode(r),
r.intent.getAction(),
r.nextReceiver - 1,
System.identityHashCode(bf));
} else {
+ ResolveInfo ri = (ResolveInfo)curReceiver;
EventLog.writeEvent(EventLogTags.AM_BROADCAST_DISCARD_APP,
- System.identityHashCode(r),
- r.intent.getAction(),
- r.nextReceiver - 1,
- ((ResolveInfo)curReceiver).toString());
+ UserHandle.getUserId(ri.activityInfo.applicationInfo.uid),
+ System.identityHashCode(r), r.intent.getAction(),
+ r.nextReceiver - 1, ri.toString());
}
} else {
Slog.w(TAG, "Discarding broadcast before first receiver is invoked: "
+ r);
EventLog.writeEvent(EventLogTags.AM_BROADCAST_DISCARD_APP,
- System.identityHashCode(r),
+ -1, System.identityHashCode(r),
r.intent.getAction(),
r.nextReceiver,
"NONE");
diff --git a/services/java/com/android/server/am/BroadcastRecord.java b/services/java/com/android/server/am/BroadcastRecord.java
index ca6d5f7..85ec328 100644
--- a/services/java/com/android/server/am/BroadcastRecord.java
+++ b/services/java/com/android/server/am/BroadcastRecord.java
@@ -194,6 +194,6 @@
public String toString() {
return "BroadcastRecord{"
+ Integer.toHexString(System.identityHashCode(this))
- + " " + intent.getAction() + "}";
+ + " u" + userId + " " + intent.getAction() + "}";
}
}
diff --git a/services/java/com/android/server/am/ConnectionRecord.java b/services/java/com/android/server/am/ConnectionRecord.java
index 5b3ff8d..4ed3c31 100644
--- a/services/java/com/android/server/am/ConnectionRecord.java
+++ b/services/java/com/android/server/am/ConnectionRecord.java
@@ -62,6 +62,8 @@
StringBuilder sb = new StringBuilder(128);
sb.append("ConnectionRecord{");
sb.append(Integer.toHexString(System.identityHashCode(this)));
+ sb.append(" u");
+ sb.append(binding.client.userId);
sb.append(' ');
if ((flags&Context.BIND_AUTO_CREATE) != 0) {
sb.append("CR ");
@@ -70,7 +72,7 @@
sb.append("DBG ");
}
if ((flags&Context.BIND_NOT_FOREGROUND) != 0) {
- sb.append("NOTFG ");
+ sb.append("!FG ");
}
if ((flags&Context.BIND_ABOVE_CLIENT) != 0) {
sb.append("ABCLT ");
@@ -88,7 +90,10 @@
sb.append("ACT ");
}
if ((flags&Context.BIND_NOT_VISIBLE) != 0) {
- sb.append("NOTVIS ");
+ sb.append("!VIS ");
+ }
+ if ((flags&Context.BIND_VISIBLE) != 0) {
+ sb.append("VIS ");
}
if (serviceDead) {
sb.append("DEAD ");
diff --git a/services/java/com/android/server/am/ContentProviderRecord.java b/services/java/com/android/server/am/ContentProviderRecord.java
index de306b5..8fb6a93 100644
--- a/services/java/com/android/server/am/ContentProviderRecord.java
+++ b/services/java/com/android/server/am/ContentProviderRecord.java
@@ -25,6 +25,7 @@
import android.os.IBinder.DeathRecipient;
import android.os.Process;
import android.os.RemoteException;
+import android.os.UserHandle;
import android.util.Slog;
import java.io.PrintWriter;
@@ -199,6 +200,8 @@
StringBuilder sb = new StringBuilder(128);
sb.append("ContentProviderRecord{");
sb.append(Integer.toHexString(System.identityHashCode(this)));
+ sb.append(" u");
+ sb.append(UserHandle.getUserId(uid));
sb.append(' ');
sb.append(name.flattenToShortString());
sb.append('}');
diff --git a/services/java/com/android/server/am/EventLogTags.logtags b/services/java/com/android/server/am/EventLogTags.logtags
index a579f44..6ee7507 100644
--- a/services/java/com/android/server/am/EventLogTags.logtags
+++ b/services/java/com/android/server/am/EventLogTags.logtags
@@ -14,72 +14,72 @@
# google3/googledata/wireless/android/provisioning/gservices.config !!
#
# An activity is being finished:
-30001 am_finish_activity (Token|1|5),(Task ID|1|5),(Component Name|3),(Reason|3)
+30001 am_finish_activity (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3),(Reason|3)
# A task is being brought to the front of the screen:
-30002 am_task_to_front (Task|1|5)
+30002 am_task_to_front (User|1|5),(Task|1|5)
# An existing activity is being given a new intent:
-30003 am_new_intent (Token|1|5),(Task ID|1|5),(Component Name|3),(Action|3),(MIME Type|3),(URI|3),(Flags|1|5)
+30003 am_new_intent (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3),(Action|3),(MIME Type|3),(URI|3),(Flags|1|5)
# A new task is being created:
-30004 am_create_task (Task ID|1|5)
+30004 am_create_task (User|1|5),(Task ID|1|5)
# A new activity is being created in an existing task:
-30005 am_create_activity (Token|1|5),(Task ID|1|5),(Component Name|3),(Action|3),(MIME Type|3),(URI|3),(Flags|1|5)
+30005 am_create_activity (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3),(Action|3),(MIME Type|3),(URI|3),(Flags|1|5)
# An activity has been resumed into the foreground but was not already running:
-30006 am_restart_activity (Token|1|5),(Task ID|1|5),(Component Name|3)
+30006 am_restart_activity (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3)
# An activity has been resumed and is now in the foreground:
-30007 am_resume_activity (Token|1|5),(Task ID|1|5),(Component Name|3)
+30007 am_resume_activity (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3)
# Application Not Responding
-30008 am_anr (pid|1|5),(Package Name|3),(Flags|1|5),(reason|3)
+30008 am_anr (User|1|5),(pid|1|5),(Package Name|3),(Flags|1|5),(reason|3)
# Activity launch time
-30009 activity_launch_time (Token|1|5),(Component Name|3),(time|2|3)
+30009 am_activity_launch_time (User|1|5),(Token|1|5),(Component Name|3),(time|2|3)
# Application process bound to work
-30010 am_proc_bound (PID|1|5),(Process Name|3)
+30010 am_proc_bound (User|1|5),(PID|1|5),(Process Name|3)
# Application process died
-30011 am_proc_died (PID|1|5),(Process Name|3)
+30011 am_proc_died (User|1|5),(PID|1|5),(Process Name|3)
# The Activity Manager failed to pause the given activity.
-30012 am_failed_to_pause (Token|1|5),(Wanting to pause|3),(Currently pausing|3)
+30012 am_failed_to_pause (User|1|5),(Token|1|5),(Wanting to pause|3),(Currently pausing|3)
# Attempting to pause the current activity
-30013 am_pause_activity (Token|1|5),(Component Name|3)
+30013 am_pause_activity (User|1|5),(Token|1|5),(Component Name|3)
# Application process has been started
-30014 am_proc_start (PID|1|5),(UID|1|5),(Process Name|3),(Type|3),(Component|3)
+30014 am_proc_start (User|1|5),(PID|1|5),(UID|1|5),(Process Name|3),(Type|3),(Component|3)
# An application process has been marked as bad
-30015 am_proc_bad (UID|1|5),(Process Name|3)
+30015 am_proc_bad (User|1|5),(UID|1|5),(Process Name|3)
# An application process that was bad is now marked as good
-30016 am_proc_good (UID|1|5),(Process Name|3)
+30016 am_proc_good (User|1|5),(UID|1|5),(Process Name|3)
# Reporting to applications that memory is low
30017 am_low_memory (Num Processes|1|1)
# An activity is being destroyed:
-30018 am_destroy_activity (Token|1|5),(Task ID|1|5),(Component Name|3),(Reason|3)
+30018 am_destroy_activity (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3),(Reason|3)
# An activity has been relaunched, resumed, and is now in the foreground:
-30019 am_relaunch_resume_activity (Token|1|5),(Task ID|1|5),(Component Name|3)
+30019 am_relaunch_resume_activity (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3)
# An activity has been relaunched:
-30020 am_relaunch_activity (Token|1|5),(Task ID|1|5),(Component Name|3)
+30020 am_relaunch_activity (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3)
# The activity's onPause has been called.
-30021 am_on_paused_called (Component Name|3)
+30021 am_on_paused_called (User|1|5),(Component Name|3)
# The activity's onResume has been called.
-30022 am_on_resume_called (Component Name|3)
+30022 am_on_resume_called (User|1|5),(Component Name|3)
# Kill a process to reclaim memory.
-30023 am_kill (PID|1|5),(Process Name|3),(OomAdj|1|5),(Reason|3)
+30023 am_kill (User|1|5),(PID|1|5),(Process Name|3),(OomAdj|1|5),(Reason|3)
# Discard an undelivered serialized broadcast (timeout/ANR/crash)
-30024 am_broadcast_discard_filter (Broadcast|1|5),(Action|3),(Receiver Number|1|1),(BroadcastFilter|1|5)
-30025 am_broadcast_discard_app (Broadcast|1|5),(Action|3),(Receiver Number|1|1),(App|3)
+30024 am_broadcast_discard_filter (User|1|5),(Broadcast|1|5),(Action|3),(Receiver Number|1|1),(BroadcastFilter|1|5)
+30025 am_broadcast_discard_app (User|1|5),(Broadcast|1|5),(Action|3),(Receiver Number|1|1),(App|3)
# A service is being created
-30030 am_create_service (Service Record|1|5),(Name|3),(Intent|3),(PID|1|5)
+30030 am_create_service (User|1|5),(Service Record|1|5),(Name|3),(Intent|3),(PID|1|5)
# A service is being destroyed
-30031 am_destroy_service (Service Record|1|5),(Name|3),(PID|1|5)
+30031 am_destroy_service (User|1|5),(Service Record|1|5),(Name|3),(PID|1|5)
# A process has crashed too many times, it is being cleared
-30032 am_process_crashed_too_much (Name|3),(PID|1|5)
+30032 am_process_crashed_too_much (User|1|5),(Name|3),(PID|1|5)
# An unknown process is trying to attach to the activity manager
30033 am_drop_process (PID|1|5)
# A service has crashed too many times, it is being stopped
-30034 am_service_crashed_too_much (Crash Count|1|1),(Component Name|3),(PID|1|5)
+30034 am_service_crashed_too_much (User|1|5),(Crash Count|1|1),(Component Name|3),(PID|1|5)
# A service is going to be restarted after its process went away
-30035 am_schedule_service_restart (Component Name|3),(Time|2|3)
+30035 am_schedule_service_restart (User|1|5),(Component Name|3),(Time|2|3)
# A client was waiting for a content provider, but its process was lost
-30036 am_provider_lost_process (Package Name|3),(UID|1|5),(Name|3)
+30036 am_provider_lost_process (User|1|5),(Package Name|3),(UID|1|5),(Name|3)
# The activity manager gave up on a new process taking too long to start
-30037 am_process_start_timeout (PID|1|5),(UID|1|5),(Process Name|3)
+30037 am_process_start_timeout (User|1|5),(PID|1|5),(UID|1|5),(Process Name|3)
# Unhandled exception
-30039 am_crash (PID|1|5),(Process Name|3),(Flags|1|5),(Exception|3),(Message|3),(File|3),(Line|1|5)
+30039 am_crash (User|1|5),(PID|1|5),(Process Name|3),(Flags|1|5),(Exception|3),(Message|3),(File|3),(Line|1|5)
# Log.wtf() called
-30040 am_wtf (PID|1|5),(Process Name|3),(Flags|1|5),(Tag|3),(Message|3)
+30040 am_wtf (User|1|5),(PID|1|5),(Process Name|3),(Flags|1|5),(Tag|3),(Message|3)
diff --git a/services/java/com/android/server/am/ProcessList.java b/services/java/com/android/server/am/ProcessList.java
index afc060e..9e25e30 100644
--- a/services/java/com/android/server/am/ProcessList.java
+++ b/services/java/com/android/server/am/ProcessList.java
@@ -101,7 +101,24 @@
// The maximum number of hidden processes we will keep around before
// killing them; this is just a control to not let us go too crazy with
// keeping around processes on devices with large amounts of RAM.
- static final int MAX_HIDDEN_APPS = 15;
+ static final int MAX_HIDDEN_APPS = 24;
+
+ // We allow empty processes to stick around for at most 30 minutes.
+ static final long MAX_EMPTY_TIME = 30*60*1000;
+
+ // The number of hidden at which we don't consider it necessary to do
+ // memory trimming.
+ static final int TRIM_HIDDEN_APPS = 3;
+
+ // The number of empty apps at which we don't consider it necessary to do
+ // memory trimming.
+ static final int TRIM_EMPTY_APPS = 3;
+
+ // Threshold of number of hidden+empty where we consider memory critical.
+ static final int TRIM_CRITICAL_THRESHOLD = 3;
+
+ // Threshold of number of hidden+empty where we consider memory critical.
+ static final int TRIM_LOW_THRESHOLD = 5;
// We put empty content processes after any hidden processes that have
// been idle for less than 15 seconds.
diff --git a/services/java/com/android/server/am/ProcessRecord.java b/services/java/com/android/server/am/ProcessRecord.java
index d372422..652fdb5 100644
--- a/services/java/com/android/server/am/ProcessRecord.java
+++ b/services/java/com/android/server/am/ProcessRecord.java
@@ -61,6 +61,7 @@
long lruWeight; // Weight for ordering in LRU list
int maxAdj; // Maximum OOM adjustment for this process
int hiddenAdj; // If hidden, this is the adjustment to use
+ int clientHiddenAdj; // If empty but hidden client, this is the adjustment to use
int emptyAdj; // If empty, this is the adjustment to use
int curRawAdj; // Current OOM unlimited adjustment for this process
int setRawAdj; // Last set OOM unlimited adjustment for this process
@@ -75,6 +76,7 @@
boolean keeping; // Actively running code so don't kill due to that?
boolean setIsForeground; // Running foreground UI when last set?
boolean hasActivities; // Are there any activities running in this process?
+ boolean hasClientActivities; // Are there any client services with activities?
boolean foregroundServices; // Running any services that are foreground?
boolean foregroundActivities; // Running any activities that are foreground?
boolean systemNoUi; // This is a system process, but not currently showing UI.
@@ -188,8 +190,7 @@
instrumentationInfo.dump(new PrintWriterPrinter(pw), prefix + " ");
}
}
- pw.print(prefix); pw.print("thread="); pw.print(thread);
- pw.print(" curReceiver="); pw.println(curReceiver);
+ pw.print(prefix); pw.print("thread="); pw.println(thread);
pw.print(prefix); pw.print("pid="); pw.print(pid); pw.print(" starting=");
pw.print(starting); pw.print(" lastPss="); pw.println(lastPss);
pw.print(prefix); pw.print("lastActivityTime=");
@@ -201,6 +202,7 @@
pw.print(" empty="); pw.println(empty);
pw.print(prefix); pw.print("oom: max="); pw.print(maxAdj);
pw.print(" hidden="); pw.print(hiddenAdj);
+ pw.print(" client="); pw.print(clientHiddenAdj);
pw.print(" empty="); pw.print(emptyAdj);
pw.print(" curRaw="); pw.print(curRawAdj);
pw.print(" setRaw="); pw.print(setRawAdj);
@@ -211,18 +213,27 @@
pw.print(" setSchedGroup="); pw.print(setSchedGroup);
pw.print(" systemNoUi="); pw.print(systemNoUi);
pw.print(" trimMemoryLevel="); pw.println(trimMemoryLevel);
- pw.print(prefix); pw.print("hasShownUi="); pw.print(hasShownUi);
- pw.print(" pendingUiClean="); pw.print(pendingUiClean);
- pw.print(" hasAboveClient="); pw.println(hasAboveClient);
- pw.print(prefix); pw.print("setIsForeground="); pw.print(setIsForeground);
- pw.print(" foregroundServices="); pw.print(foregroundServices);
- pw.print(" forcingToForeground="); pw.println(forcingToForeground);
- pw.print(prefix); pw.print("persistent="); pw.print(persistent);
- pw.print(" removed="); pw.print(removed);
- pw.print(" hasActivities="); pw.print(hasActivities);
- pw.print(" foregroundActivities="); pw.println(foregroundActivities);
pw.print(prefix); pw.print("adjSeq="); pw.print(adjSeq);
pw.print(" lruSeq="); pw.println(lruSeq);
+ if (hasShownUi || pendingUiClean || hasAboveClient) {
+ pw.print(prefix); pw.print("hasShownUi="); pw.print(hasShownUi);
+ pw.print(" pendingUiClean="); pw.print(pendingUiClean);
+ pw.print(" hasAboveClient="); pw.println(hasAboveClient);
+ }
+ if (setIsForeground || foregroundServices || forcingToForeground != null) {
+ pw.print(prefix); pw.print("setIsForeground="); pw.print(setIsForeground);
+ pw.print(" foregroundServices="); pw.print(foregroundServices);
+ pw.print(" forcingToForeground="); pw.println(forcingToForeground);
+ }
+ if (persistent || removed) {
+ pw.print(prefix); pw.print("persistent="); pw.print(persistent);
+ pw.print(" removed="); pw.println(removed);
+ }
+ if (hasActivities || hasClientActivities || foregroundActivities) {
+ pw.print(prefix); pw.print("hasActivities="); pw.print(hasActivities);
+ pw.print(" hasClientActivities="); pw.print(hasClientActivities);
+ pw.print(" foregroundActivities="); pw.println(foregroundActivities);
+ }
if (!keeping) {
long wtime;
synchronized (batteryStats.getBatteryStats()) {
@@ -231,10 +242,10 @@
}
long timeUsed = wtime - lastWakeTime;
pw.print(prefix); pw.print("lastWakeTime="); pw.print(lastWakeTime);
- pw.print(" time used=");
+ pw.print(" timeUsed=");
TimeUtils.formatDuration(timeUsed, pw); pw.println("");
pw.print(prefix); pw.print("lastCpuTime="); pw.print(lastCpuTime);
- pw.print(" time used=");
+ pw.print(" timeUsed=");
TimeUtils.formatDuration(curCpuTime-lastCpuTime, pw); pw.println("");
}
pw.print(prefix); pw.print("lastRequestedGc=");
@@ -299,6 +310,9 @@
pw.print(prefix); pw.print(" - "); pw.println(conProviders.get(i).toShortString());
}
}
+ if (curReceiver != null) {
+ pw.print(prefix); pw.print("curReceiver="); pw.println(curReceiver);
+ }
if (receivers.size() > 0) {
pw.print(prefix); pw.println("Receivers:");
for (ReceiverList rl : receivers) {
@@ -318,7 +332,7 @@
pkgList.add(_info.packageName);
thread = _thread;
maxAdj = ProcessList.HIDDEN_APP_MAX_ADJ;
- hiddenAdj = emptyAdj = ProcessList.HIDDEN_APP_MIN_ADJ;
+ hiddenAdj = clientHiddenAdj = emptyAdj = ProcessList.HIDDEN_APP_MIN_ADJ;
curRawAdj = setRawAdj = -100;
curAdj = setAdj = -100;
persistent = false;
diff --git a/services/java/com/android/server/am/ServiceRecord.java b/services/java/com/android/server/am/ServiceRecord.java
index 7055fdc..84e824a 100644
--- a/services/java/com/android/server/am/ServiceRecord.java
+++ b/services/java/com/android/server/am/ServiceRecord.java
@@ -425,6 +425,7 @@
StringBuilder sb = new StringBuilder(128);
sb.append("ServiceRecord{")
.append(Integer.toHexString(System.identityHashCode(this)))
+ .append(" u").append(userId)
.append(' ').append(shortName).append('}');
return stringName = sb.toString();
}
diff --git a/services/java/com/android/server/display/DisplayManagerService.java b/services/java/com/android/server/display/DisplayManagerService.java
index 85f3b56..f348cb6 100644
--- a/services/java/com/android/server/display/DisplayManagerService.java
+++ b/services/java/com/android/server/display/DisplayManagerService.java
@@ -352,11 +352,6 @@
@Override // Binder call
public void scanWifiDisplays() {
- if (mContext.checkCallingPermission(android.Manifest.permission.CONFIGURE_WIFI_DISPLAY)
- != PackageManager.PERMISSION_GRANTED) {
- throw new SecurityException("Requires CONFIGURE_WIFI_DISPLAY permission");
- }
-
final long token = Binder.clearCallingIdentity();
try {
synchronized (mSyncRoot) {
@@ -371,19 +366,16 @@
@Override // Binder call
public void connectWifiDisplay(String address) {
- if (mContext.checkCallingPermission(android.Manifest.permission.CONFIGURE_WIFI_DISPLAY)
- != PackageManager.PERMISSION_GRANTED) {
- throw new SecurityException("Requires CONFIGURE_WIFI_DISPLAY permission");
- }
if (address == null) {
throw new IllegalArgumentException("address must not be null");
}
+ final boolean trusted = canCallerConfigureWifiDisplay();
final long token = Binder.clearCallingIdentity();
try {
synchronized (mSyncRoot) {
if (mWifiDisplayAdapter != null) {
- mWifiDisplayAdapter.requestConnectLocked(address);
+ mWifiDisplayAdapter.requestConnectLocked(address, trusted);
}
}
} finally {
@@ -393,11 +385,6 @@
@Override // Binder call
public void disconnectWifiDisplay() {
- if (mContext.checkCallingPermission(android.Manifest.permission.CONFIGURE_WIFI_DISPLAY)
- != PackageManager.PERMISSION_GRANTED) {
- throw new SecurityException("Requires CONFIGURE_WIFI_DISPLAY permission");
- }
-
final long token = Binder.clearCallingIdentity();
try {
synchronized (mSyncRoot) {
@@ -412,13 +399,13 @@
@Override // Binder call
public void renameWifiDisplay(String address, String alias) {
- if (mContext.checkCallingPermission(android.Manifest.permission.CONFIGURE_WIFI_DISPLAY)
- != PackageManager.PERMISSION_GRANTED) {
- throw new SecurityException("Requires CONFIGURE_WIFI_DISPLAY permission");
- }
if (address == null) {
throw new IllegalArgumentException("address must not be null");
}
+ if (!canCallerConfigureWifiDisplay()) {
+ throw new SecurityException("Requires CONFIGURE_WIFI_DISPLAY permission to "
+ + "rename a wifi display.");
+ }
final long token = Binder.clearCallingIdentity();
try {
@@ -434,13 +421,13 @@
@Override // Binder call
public void forgetWifiDisplay(String address) {
- if (mContext.checkCallingPermission(android.Manifest.permission.CONFIGURE_WIFI_DISPLAY)
- != PackageManager.PERMISSION_GRANTED) {
- throw new SecurityException("Requires CONFIGURE_WIFI_DISPLAY permission");
- }
if (address == null) {
throw new IllegalArgumentException("address must not be null");
}
+ if (!canCallerConfigureWifiDisplay()) {
+ throw new SecurityException("Requires CONFIGURE_WIFI_DISPLAY permission to "
+ + "forget a wifi display.");
+ }
final long token = Binder.clearCallingIdentity();
try {
@@ -456,11 +443,6 @@
@Override // Binder call
public WifiDisplayStatus getWifiDisplayStatus() {
- if (mContext.checkCallingPermission(android.Manifest.permission.CONFIGURE_WIFI_DISPLAY)
- != PackageManager.PERMISSION_GRANTED) {
- throw new SecurityException("Requires CONFIGURE_WIFI_DISPLAY permission");
- }
-
final long token = Binder.clearCallingIdentity();
try {
synchronized (mSyncRoot) {
@@ -475,6 +457,11 @@
}
}
+ private boolean canCallerConfigureWifiDisplay() {
+ return mContext.checkCallingPermission(android.Manifest.permission.CONFIGURE_WIFI_DISPLAY)
+ == PackageManager.PERMISSION_GRANTED;
+ }
+
private void registerDefaultDisplayAdapter() {
// Register default display adapter.
synchronized (mSyncRoot) {
diff --git a/services/java/com/android/server/display/WifiDisplayAdapter.java b/services/java/com/android/server/display/WifiDisplayAdapter.java
index 1d50ded..4a89be7 100644
--- a/services/java/com/android/server/display/WifiDisplayAdapter.java
+++ b/services/java/com/android/server/display/WifiDisplayAdapter.java
@@ -27,6 +27,7 @@
import android.media.RemoteDisplay;
import android.os.Handler;
import android.os.IBinder;
+import android.util.Slog;
import android.view.Surface;
import java.io.PrintWriter;
@@ -121,7 +122,17 @@
});
}
- public void requestConnectLocked(final String address) {
+ public void requestConnectLocked(final String address, final boolean trusted) {
+ if (!trusted) {
+ synchronized (getSyncRoot()) {
+ if (!isRememberedDisplayLocked(address)) {
+ Slog.w(TAG, "Ignoring request by an untrusted client to connect to "
+ + "an unknown wifi display: " + address);
+ return;
+ }
+ }
+ }
+
getHandler().post(new Runnable() {
@Override
public void run() {
@@ -132,6 +143,15 @@
});
}
+ private boolean isRememberedDisplayLocked(String address) {
+ for (WifiDisplay display : mRememberedDisplays) {
+ if (display.getDeviceAddress().equals(address)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
public void requestDisconnectLocked() {
getHandler().post(new Runnable() {
@Override
@@ -241,10 +261,8 @@
getWifiDisplayStatusLocked());
}
- // Send protected broadcast about wifi display status to receivers that
- // have the required permission.
- getContext().sendBroadcast(intent,
- android.Manifest.permission.CONFIGURE_WIFI_DISPLAY);
+ // Send protected broadcast about wifi display status to registered receivers.
+ getContext().sendBroadcast(intent);
}
};
diff --git a/services/java/com/android/server/dreams/DreamController.java b/services/java/com/android/server/dreams/DreamController.java
new file mode 100644
index 0000000..81c80187
--- /dev/null
+++ b/services/java/com/android/server/dreams/DreamController.java
@@ -0,0 +1,243 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.server.dreams;
+
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.os.Binder;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.os.IBinder.DeathRecipient;
+import android.service.dreams.Dream;
+import android.service.dreams.IDreamService;
+import android.util.Slog;
+import android.view.IWindowManager;
+import android.view.WindowManager;
+import android.view.WindowManagerGlobal;
+
+import java.io.PrintWriter;
+import java.util.NoSuchElementException;
+
+/**
+ * Internal controller for starting and stopping the current dream and managing related state.
+ *
+ * Assumes all operations are called from the dream handler thread.
+ */
+final class DreamController {
+ private static final String TAG = "DreamController";
+
+ private final Context mContext;
+ private final Handler mHandler;
+ private final Listener mListener;
+ private final IWindowManager mIWindowManager;
+
+ private final Intent mDreamingStartedIntent = new Intent(Dream.ACTION_DREAMING_STARTED)
+ .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
+ private final Intent mDreamingStoppedIntent = new Intent(Dream.ACTION_DREAMING_STOPPED)
+ .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
+
+ private DreamRecord mCurrentDream;
+
+ public DreamController(Context context, Handler handler, Listener listener) {
+ mContext = context;
+ mHandler = handler;
+ mListener = listener;
+ mIWindowManager = WindowManagerGlobal.getWindowManagerService();
+ }
+
+ public void dump(PrintWriter pw) {
+ pw.println("Dreamland:");
+ if (mCurrentDream != null) {
+ pw.println(" mCurrentDream:");
+ pw.println(" mToken=" + mCurrentDream.mToken);
+ pw.println(" mName=" + mCurrentDream.mName);
+ pw.println(" mIsTest=" + mCurrentDream.mIsTest);
+ pw.println(" mUserId=" + mCurrentDream.mUserId);
+ pw.println(" mBound=" + mCurrentDream.mBound);
+ pw.println(" mService=" + mCurrentDream.mService);
+ pw.println(" mSentStartBroadcast=" + mCurrentDream.mSentStartBroadcast);
+ } else {
+ pw.println(" mCurrentDream: null");
+ }
+ }
+
+ public void startDream(Binder token, ComponentName name, boolean isTest, int userId) {
+ stopDream();
+
+ Slog.i(TAG, "Starting dream: name=" + name + ", isTest=" + isTest + ", userId=" + userId);
+
+ mCurrentDream = new DreamRecord(token, name, isTest, userId);
+
+ try {
+ mIWindowManager.addWindowToken(token, WindowManager.LayoutParams.TYPE_DREAM);
+ } catch (RemoteException ex) {
+ Slog.e(TAG, "Unable to add window token for dream.", ex);
+ stopDream();
+ return;
+ }
+
+ Intent intent = new Intent(Intent.ACTION_MAIN);
+ intent.addCategory(Dream.CATEGORY_DREAM);
+ intent.setComponent(name);
+ intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
+ try {
+ if (!mContext.bindService(intent, mCurrentDream,
+ Context.BIND_AUTO_CREATE, userId)) {
+ Slog.e(TAG, "Unable to bind dream service: " + intent);
+ stopDream();
+ return;
+ }
+ } catch (SecurityException ex) {
+ Slog.e(TAG, "Unable to bind dream service: " + intent, ex);
+ stopDream();
+ return;
+ }
+
+ mCurrentDream.mBound = true;
+ }
+
+ public void stopDream() {
+ if (mCurrentDream == null) {
+ return;
+ }
+
+ final DreamRecord oldDream = mCurrentDream;
+ mCurrentDream = null;
+ Slog.i(TAG, "Stopping dream: name=" + oldDream.mName
+ + ", isTest=" + oldDream.mIsTest + ", userId=" + oldDream.mUserId);
+
+ if (oldDream.mSentStartBroadcast) {
+ mContext.sendBroadcast(mDreamingStoppedIntent);
+ }
+
+ if (oldDream.mService != null) {
+ // TODO: It would be nice to tell the dream that it's being stopped so that
+ // it can shut down nicely before we yank its window token out from under it.
+ try {
+ oldDream.mService.asBinder().unlinkToDeath(oldDream, 0);
+ } catch (NoSuchElementException ex) {
+ // don't care
+ }
+ oldDream.mService = null;
+ }
+
+ if (oldDream.mBound) {
+ mContext.unbindService(oldDream);
+ }
+
+ try {
+ mIWindowManager.removeWindowToken(oldDream.mToken);
+ } catch (RemoteException ex) {
+ Slog.w(TAG, "Error removing window token for dream.", ex);
+ }
+
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ mListener.onDreamStopped(oldDream.mToken);
+ }
+ });
+ }
+
+ private void attach(IDreamService service) {
+ try {
+ service.asBinder().linkToDeath(mCurrentDream, 0);
+ service.attach(mCurrentDream.mToken);
+ } catch (RemoteException ex) {
+ Slog.e(TAG, "The dream service died unexpectedly.", ex);
+ stopDream();
+ return;
+ }
+
+ mCurrentDream.mService = service;
+
+ if (!mCurrentDream.mIsTest) {
+ mContext.sendBroadcast(mDreamingStartedIntent);
+ mCurrentDream.mSentStartBroadcast = true;
+ }
+ }
+
+ /**
+ * Callback interface to be implemented by the {@link DreamManagerService}.
+ */
+ public interface Listener {
+ void onDreamStopped(Binder token);
+ }
+
+ private final class DreamRecord implements DeathRecipient, ServiceConnection {
+ public final Binder mToken;
+ public final ComponentName mName;
+ public final boolean mIsTest;
+ public final int mUserId;
+
+ public boolean mBound;
+ public IDreamService mService;
+ public boolean mSentStartBroadcast;
+
+ public DreamRecord(Binder token, ComponentName name,
+ boolean isTest, int userId) {
+ mToken = token;
+ mName = name;
+ mIsTest = isTest;
+ mUserId = userId;
+ }
+
+ // May be called on any thread.
+ @Override
+ public void binderDied() {
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ mService = null;
+ if (mCurrentDream == DreamRecord.this) {
+ stopDream();
+ }
+ }
+ });
+ }
+
+ // May be called on any thread.
+ @Override
+ public void onServiceConnected(ComponentName name, final IBinder service) {
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ if (mCurrentDream == DreamRecord.this && mService == null) {
+ attach(IDreamService.Stub.asInterface(service));
+ }
+ }
+ });
+ }
+
+ // May be called on any thread.
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ mService = null;
+ if (mCurrentDream == DreamRecord.this) {
+ stopDream();
+ }
+ }
+ });
+ }
+ }
+}
\ No newline at end of file
diff --git a/services/java/com/android/server/dreams/DreamManagerService.java b/services/java/com/android/server/dreams/DreamManagerService.java
new file mode 100644
index 0000000..1f40176
--- /dev/null
+++ b/services/java/com/android/server/dreams/DreamManagerService.java
@@ -0,0 +1,383 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.server.dreams;
+
+import com.android.internal.util.DumpUtils;
+
+import android.app.ActivityManager;
+import android.content.BroadcastReceiver;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.pm.PackageManager;
+import android.os.Binder;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.Looper;
+import android.os.PowerManager;
+import android.os.SystemClock;
+import android.os.UserHandle;
+import android.provider.Settings;
+import android.service.dreams.IDreamManager;
+import android.util.Slog;
+
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
+
+import libcore.util.Objects;
+
+/**
+ * Service api for managing dreams.
+ *
+ * @hide
+ */
+public final class DreamManagerService extends IDreamManager.Stub {
+ private static final boolean DEBUG = true;
+ private static final String TAG = "DreamManagerService";
+
+ private final Object mLock = new Object();
+
+ private final Context mContext;
+ private final DreamHandler mHandler;
+ private final DreamController mController;
+ private final PowerManager mPowerManager;
+
+ private Binder mCurrentDreamToken;
+ private ComponentName mCurrentDreamName;
+ private int mCurrentDreamUserId;
+ private boolean mCurrentDreamIsTest;
+
+ public DreamManagerService(Context context, Handler mainHandler) {
+ mContext = context;
+ mHandler = new DreamHandler(mainHandler.getLooper());
+ mController = new DreamController(context, mHandler, mControllerListener);
+
+ mPowerManager = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
+ }
+
+ public void systemReady() {
+ mContext.registerReceiver(new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ synchronized (mLock) {
+ stopDreamLocked();
+ }
+ }
+ }, new IntentFilter(Intent.ACTION_USER_SWITCHED), null, mHandler);
+ }
+
+ @Override
+ protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+ mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);
+
+ pw.println("DREAM MANAGER (dumpsys dreams)");
+ pw.println();
+
+ pw.println("mCurrentDreamToken=" + mCurrentDreamToken);
+ pw.println("mCurrentDreamName=" + mCurrentDreamName);
+ pw.println("mCurrentDreamUserId=" + mCurrentDreamUserId);
+ pw.println("mCurrentDreamIsTest=" + mCurrentDreamIsTest);
+ pw.println();
+
+ DumpUtils.dumpAsync(mHandler, new DumpUtils.Dump() {
+ @Override
+ public void dump(PrintWriter pw) {
+ mController.dump(pw);
+ }
+ }, pw, 200);
+ }
+
+ @Override // Binder call
+ public ComponentName[] getDreamComponents() {
+ checkPermission(android.Manifest.permission.READ_DREAM_STATE);
+
+ final int userId = UserHandle.getCallingUserId();
+ final long ident = Binder.clearCallingIdentity();
+ try {
+ return getDreamComponentsForUser(userId);
+ } finally {
+ Binder.restoreCallingIdentity(ident);
+ }
+ }
+
+ @Override // Binder call
+ public void setDreamComponents(ComponentName[] componentNames) {
+ checkPermission(android.Manifest.permission.WRITE_DREAM_STATE);
+
+ final int userId = UserHandle.getCallingUserId();
+ final long ident = Binder.clearCallingIdentity();
+ try {
+ Settings.Secure.putStringForUser(mContext.getContentResolver(),
+ Settings.Secure.SCREENSAVER_COMPONENTS,
+ componentsToString(componentNames),
+ userId);
+ } finally {
+ Binder.restoreCallingIdentity(ident);
+ }
+ }
+
+ @Override // Binder call
+ public ComponentName getDefaultDreamComponent() {
+ checkPermission(android.Manifest.permission.READ_DREAM_STATE);
+
+ final int userId = UserHandle.getCallingUserId();
+ final long ident = Binder.clearCallingIdentity();
+ try {
+ String name = Settings.Secure.getStringForUser(mContext.getContentResolver(),
+ Settings.Secure.SCREENSAVER_DEFAULT_COMPONENT,
+ userId);
+ return name == null ? null : ComponentName.unflattenFromString(name);
+ } finally {
+ Binder.restoreCallingIdentity(ident);
+ }
+ }
+
+ @Override // Binder call
+ public boolean isDreaming() {
+ checkPermission(android.Manifest.permission.READ_DREAM_STATE);
+
+ synchronized (mLock) {
+ return mCurrentDreamToken != null && !mCurrentDreamIsTest;
+ }
+ }
+
+ @Override // Binder call
+ public void dream() {
+ checkPermission(android.Manifest.permission.WRITE_DREAM_STATE);
+
+ final long ident = Binder.clearCallingIdentity();
+ try {
+ // Ask the power manager to nap. It will eventually call back into
+ // startDream() if/when it is appropriate to start dreaming.
+ // Because napping could cause the screen to turn off immediately if the dream
+ // cannot be started, we keep one eye open and gently poke user activity.
+ long time = SystemClock.uptimeMillis();
+ mPowerManager.userActivity(time, true /*noChangeLights*/);
+ mPowerManager.nap(time);
+ } finally {
+ Binder.restoreCallingIdentity(ident);
+ }
+ }
+
+ @Override // Binder call
+ public void testDream(ComponentName dream) {
+ checkPermission(android.Manifest.permission.WRITE_DREAM_STATE);
+
+ if (dream == null) {
+ throw new IllegalArgumentException("dream must not be null");
+ }
+
+ final int callingUserId = UserHandle.getCallingUserId();
+ final int currentUserId = ActivityManager.getCurrentUser();
+ if (callingUserId != currentUserId) {
+ // This check is inherently prone to races but at least it's something.
+ Slog.w(TAG, "Aborted attempt to start a test dream while a different "
+ + " user is active: callingUserId=" + callingUserId
+ + ", currentUserId=" + currentUserId);
+ return;
+ }
+ final long ident = Binder.clearCallingIdentity();
+ try {
+ synchronized (mLock) {
+ startDreamLocked(dream, true /*isTest*/, callingUserId);
+ }
+ } finally {
+ Binder.restoreCallingIdentity(ident);
+ }
+ }
+
+ @Override // Binder call
+ public void awaken() {
+ checkPermission(android.Manifest.permission.WRITE_DREAM_STATE);
+
+ final long ident = Binder.clearCallingIdentity();
+ try {
+ // Treat an explicit request to awaken as user activity so that the
+ // device doesn't immediately go to sleep if the timeout expired,
+ // for example when being undocked.
+ long time = SystemClock.uptimeMillis();
+ mPowerManager.userActivity(time, false /*noChangeLights*/);
+ stopDream();
+ } finally {
+ Binder.restoreCallingIdentity(ident);
+ }
+ }
+
+ @Override // Binder call
+ public void finishSelf(IBinder token) {
+ // Requires no permission, called by Dream from an arbitrary process.
+ if (token == null) {
+ throw new IllegalArgumentException("token must not be null");
+ }
+
+ final long ident = Binder.clearCallingIdentity();
+ try {
+ if (DEBUG) {
+ Slog.d(TAG, "Dream finished: " + token);
+ }
+
+ // Note that a dream finishing and self-terminating is not
+ // itself considered user activity. If the dream is ending because
+ // the user interacted with the device then user activity will already
+ // have been poked so the device will stay awake a bit longer.
+ // If the dream is ending on its own for other reasons and no wake
+ // locks are held and the user activity timeout has expired then the
+ // device may simply go to sleep.
+ synchronized (mLock) {
+ if (mCurrentDreamToken == token) {
+ stopDreamLocked();
+ }
+ }
+ } finally {
+ Binder.restoreCallingIdentity(ident);
+ }
+ }
+
+ /**
+ * Called by the power manager to start a dream.
+ */
+ public void startDream() {
+ int userId = ActivityManager.getCurrentUser();
+ ComponentName dream = chooseDreamForUser(userId);
+ if (dream != null) {
+ synchronized (mLock) {
+ startDreamLocked(dream, false /*isTest*/, userId);
+ }
+ }
+ }
+
+ /**
+ * Called by the power manager to stop a dream.
+ */
+ public void stopDream() {
+ synchronized (mLock) {
+ stopDreamLocked();
+ }
+ }
+
+ private ComponentName chooseDreamForUser(int userId) {
+ ComponentName[] dreams = getDreamComponentsForUser(userId);
+ return dreams != null && dreams.length != 0 ? dreams[0] : null;
+ }
+
+ private ComponentName[] getDreamComponentsForUser(int userId) {
+ String names = Settings.Secure.getStringForUser(mContext.getContentResolver(),
+ Settings.Secure.SCREENSAVER_COMPONENTS,
+ userId);
+ return names == null ? null : componentsFromString(names);
+ }
+
+ private void startDreamLocked(final ComponentName name,
+ final boolean isTest, final int userId) {
+ if (Objects.equal(mCurrentDreamName, name)
+ && mCurrentDreamIsTest == isTest
+ && mCurrentDreamUserId == userId) {
+ return;
+ }
+
+ stopDreamLocked();
+
+ Slog.i(TAG, "Entering dreamland.");
+
+ final Binder newToken = new Binder();
+ mCurrentDreamToken = newToken;
+ mCurrentDreamName = name;
+ mCurrentDreamIsTest = isTest;
+ mCurrentDreamUserId = userId;
+
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ mController.startDream(newToken, name, isTest, userId);
+ }
+ });
+ }
+
+ private void stopDreamLocked() {
+ if (mCurrentDreamToken != null) {
+ Slog.i(TAG, "Leaving dreamland.");
+
+ cleanupDreamLocked();
+
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ mController.stopDream();
+ }
+ });
+ }
+ }
+
+ private void cleanupDreamLocked() {
+ mCurrentDreamToken = null;
+ mCurrentDreamName = null;
+ mCurrentDreamIsTest = false;
+ mCurrentDreamUserId = 0;
+ }
+
+ private void checkPermission(String permission) {
+ if (mContext.checkCallingOrSelfPermission(permission)
+ != PackageManager.PERMISSION_GRANTED) {
+ throw new SecurityException("Access denied to process: " + Binder.getCallingPid()
+ + ", must have permission " + permission);
+ }
+ }
+
+ private static String componentsToString(ComponentName[] componentNames) {
+ StringBuilder names = new StringBuilder();
+ if (componentNames != null) {
+ for (ComponentName componentName : componentNames) {
+ if (names.length() > 0) {
+ names.append(',');
+ }
+ names.append(componentName.flattenToString());
+ }
+ }
+ return names.toString();
+ }
+
+ private static ComponentName[] componentsFromString(String names) {
+ String[] namesArray = names.split(",");
+ ComponentName[] componentNames = new ComponentName[namesArray.length];
+ for (int i = 0; i < namesArray.length; i++) {
+ componentNames[i] = ComponentName.unflattenFromString(namesArray[i]);
+ }
+ return componentNames;
+ }
+
+ private final DreamController.Listener mControllerListener = new DreamController.Listener() {
+ @Override
+ public void onDreamStopped(Binder token) {
+ synchronized (mLock) {
+ if (mCurrentDreamToken == token) {
+ cleanupDreamLocked();
+ }
+ }
+ }
+ };
+
+ /**
+ * Handler for asynchronous operations performed by the dream manager.
+ * Ensures operations to {@link DreamController} are single-threaded.
+ */
+ private final class DreamHandler extends Handler {
+ public DreamHandler(Looper looper) {
+ super(looper, null, true /*async*/);
+ }
+ }
+}
diff --git a/services/java/com/android/server/location/GpsLocationProvider.java b/services/java/com/android/server/location/GpsLocationProvider.java
index 28870a2..84adb83 100755
--- a/services/java/com/android/server/location/GpsLocationProvider.java
+++ b/services/java/com/android/server/location/GpsLocationProvider.java
@@ -1029,7 +1029,7 @@
mLocation.setTime(timestamp);
// It would be nice to push the elapsed real-time timestamp
// further down the stack, but this is still useful
- mLocation.setElapsedRealtimeNano(SystemClock.elapsedRealtimeNano());
+ mLocation.setElapsedRealtimeNanos(SystemClock.elapsedRealtimeNanos());
}
if ((flags & LOCATION_HAS_ALTITUDE) == LOCATION_HAS_ALTITUDE) {
mLocation.setAltitude(altitude);
diff --git a/services/java/com/android/server/location/LocationBasedCountryDetector.java b/services/java/com/android/server/location/LocationBasedCountryDetector.java
index 38871d78..03db621 100755
--- a/services/java/com/android/server/location/LocationBasedCountryDetector.java
+++ b/services/java/com/android/server/location/LocationBasedCountryDetector.java
@@ -115,8 +115,8 @@
Location lastKnownLocation = mLocationManager.getLastKnownLocation(provider);
if (lastKnownLocation != null) {
if (bestLocation == null ||
- bestLocation.getElapsedRealtimeNano() <
- lastKnownLocation.getElapsedRealtimeNano()) {
+ bestLocation.getElapsedRealtimeNanos() <
+ lastKnownLocation.getElapsedRealtimeNanos()) {
bestLocation = lastKnownLocation;
}
}
diff --git a/services/java/com/android/server/power/PowerManagerService.java b/services/java/com/android/server/power/PowerManagerService.java
index 030eb5e..ad138e8 100644
--- a/services/java/com/android/server/power/PowerManagerService.java
+++ b/services/java/com/android/server/power/PowerManagerService.java
@@ -24,6 +24,7 @@
import com.android.server.Watchdog;
import com.android.server.am.ActivityManagerService;
import com.android.server.display.DisplayManagerService;
+import com.android.server.dreams.DreamManagerService;
import android.Manifest;
import android.content.BroadcastReceiver;
@@ -46,13 +47,11 @@
import android.os.PowerManager;
import android.os.Process;
import android.os.RemoteException;
-import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.UserHandle;
import android.os.WorkSource;
import android.provider.Settings;
import android.service.dreams.Dream;
-import android.service.dreams.IDreamManager;
import android.util.EventLog;
import android.util.Log;
import android.util.Slog;
@@ -100,14 +99,12 @@
private static final int DIRTY_STAY_ON = 1 << 7;
// Dirty bit: battery state changed
private static final int DIRTY_BATTERY_STATE = 1 << 8;
- // Dirty bit: dream ended
- private static final int DIRTY_DREAM_ENDED = 1 << 9;
// Wakefulness: The device is asleep and can only be awoken by a call to wakeUp().
// The screen should be off or in the process of being turned off by the display controller.
private static final int WAKEFULNESS_ASLEEP = 0;
// Wakefulness: The device is fully awake. It can be put to sleep by a call to goToSleep().
- // When the user activity timeout expires, the device may start napping.
+ // When the user activity timeout expires, the device may start napping or go to sleep.
private static final int WAKEFULNESS_AWAKE = 1;
// Wakefulness: The device is napping. It is deciding whether to dream or go to sleep
// but hasn't gotten around to it yet. It can be awoken by a call to wakeUp(), which
@@ -149,7 +146,7 @@
private Notifier mNotifier;
private DisplayPowerController mDisplayPowerController;
private SettingsObserver mSettingsObserver;
- private IDreamManager mDreamManager;
+ private DreamManagerService mDreamManager;
private LightsService.Light mAttentionLight;
private final Object mLock = new Object();
@@ -335,9 +332,10 @@
}
}
- public void systemReady(TwilightService twilight) {
+ public void systemReady(TwilightService twilight, DreamManagerService dreamManager) {
synchronized (mLock) {
mSystemReady = true;
+ mDreamManager = dreamManager;
PowerManager pm = (PowerManager)mContext.getSystemService(Context.POWER_SERVICE);
mScreenBrightnessSettingMinimum = pm.getMinimumScreenBrightnessSetting();
@@ -365,10 +363,7 @@
mContext.registerReceiver(new BootCompletedReceiver(), filter, null, mHandler);
filter = new IntentFilter();
- filter.addAction(Intent.ACTION_DOCK_EVENT);
- mContext.registerReceiver(new DockReceiver(), filter, null, mHandler);
-
- filter = new IntentFilter();
+ filter.addAction(Dream.ACTION_DREAMING_STARTED);
filter.addAction(Dream.ACTION_DREAMING_STOPPED);
mContext.registerReceiver(new DreamReceiver(), filter, null, mHandler);
@@ -887,6 +882,47 @@
return true;
}
+ @Override // Binder call
+ public void nap(long eventTime) {
+ if (eventTime > SystemClock.uptimeMillis()) {
+ throw new IllegalArgumentException("event time must not be in the future");
+ }
+
+ mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER, null);
+
+ final long ident = Binder.clearCallingIdentity();
+ try {
+ napInternal(eventTime);
+ } finally {
+ Binder.restoreCallingIdentity(ident);
+ }
+ }
+
+ private void napInternal(long eventTime) {
+ synchronized (mLock) {
+ if (napNoUpdateLocked(eventTime)) {
+ updatePowerStateLocked();
+ }
+ }
+ }
+
+ private boolean napNoUpdateLocked(long eventTime) {
+ if (DEBUG_SPEW) {
+ Slog.d(TAG, "napNoUpdateLocked: eventTime=" + eventTime);
+ }
+
+ if (eventTime < mLastWakeTime || mWakefulness != WAKEFULNESS_AWAKE
+ || !mBootCompleted || !mSystemReady) {
+ return false;
+ }
+
+ Slog.i(TAG, "Nap time...");
+
+ mDirty |= DIRTY_WAKEFULNESS;
+ mWakefulness = WAKEFULNESS_NAPPING;
+ return true;
+ }
+
/**
* Updates the global power state based on dirty bits recorded in mDirty.
*
@@ -1143,11 +1179,15 @@
| DIRTY_WAKEFULNESS | DIRTY_STAY_ON)) != 0) {
if (mWakefulness == WAKEFULNESS_AWAKE && isItBedTimeYetLocked()) {
if (DEBUG_SPEW) {
- Slog.d(TAG, "updateWakefulnessLocked: Nap time...");
+ Slog.d(TAG, "updateWakefulnessLocked: Bed time...");
}
- mWakefulness = WAKEFULNESS_NAPPING;
- mDirty |= DIRTY_WAKEFULNESS;
- changed = true;
+ final long time = SystemClock.uptimeMillis();
+ if (mDreamsActivateOnSleepSetting) {
+ changed = napNoUpdateLocked(time);
+ } else {
+ changed = goToSleepNoUpdateLocked(time,
+ PowerManager.GO_TO_SLEEP_REASON_TIMEOUT);
+ }
}
}
return changed;
@@ -1172,8 +1212,7 @@
| DIRTY_SETTINGS
| DIRTY_IS_POWERED
| DIRTY_STAY_ON
- | DIRTY_BATTERY_STATE
- | DIRTY_DREAM_ENDED)) != 0) {
+ | DIRTY_BATTERY_STATE)) != 0) {
scheduleSandmanLocked();
}
}
@@ -1210,32 +1249,15 @@
}
}
- // Get the dream manager, if needed.
- if (startDreaming && mDreamManager == null) {
- mDreamManager = IDreamManager.Stub.asInterface(
- ServiceManager.checkService("dreams"));
- if (mDreamManager == null) {
- Slog.w(TAG, "Unable to find IDreamManager.");
- }
- }
-
// Start dreaming if needed.
// We only control the dream on the handler thread, so we don't need to worry about
// concurrent attempts to start or stop the dream.
boolean isDreaming = false;
if (mDreamManager != null) {
- try {
- isDreaming = mDreamManager.isDreaming();
- if (startDreaming && !isDreaming) {
- Slog.i(TAG, "Entering dreamland.");
- mDreamManager.dream();
- isDreaming = mDreamManager.isDreaming();
- if (!isDreaming) {
- Slog.i(TAG, "Could not enter dreamland. Sleep will be dreamless.");
- }
- }
- } catch (RemoteException ex) {
+ if (startDreaming) {
+ mDreamManager.startDream();
}
+ isDreaming = mDreamManager.isDreaming();
}
// Update dream state.
@@ -1255,18 +1277,6 @@
if (!continueDreaming) {
handleDreamFinishedLocked();
}
-
- // In addition to listening for the intent, poll the sandman periodically to detect
- // when the dream has ended (as a watchdog only, ensuring our state is always correct).
- if (mWakefulness == WAKEFULNESS_DREAMING
- || mWakefulness == WAKEFULNESS_NAPPING) {
- if (!mSandmanScheduled) {
- mSandmanScheduled = true;
- Message msg = mHandler.obtainMessage(MSG_SANDMAN);
- msg.setAsynchronous(true);
- mHandler.sendMessageDelayed(msg, 5000);
- }
- }
}
// Stop dreaming if needed.
@@ -1274,26 +1284,22 @@
// If so, then the power manager will have posted another message to the handler
// to take care of it later.
if (mDreamManager != null) {
- try {
- if (!continueDreaming && isDreaming) {
- Slog.i(TAG, "Leaving dreamland.");
- mDreamManager.awaken();
- }
- } catch (RemoteException ex) {
+ if (!continueDreaming) {
+ mDreamManager.stopDream();
}
}
}
/**
* Returns true if the device is allowed to dream in its current state,
- * assuming there has been no recent user activity and no wake locks are held.
+ * assuming that there was either an explicit request to nap or the user activity
+ * timeout expired and no wake locks are held.
*/
private boolean canDreamLocked() {
return mIsPowered
&& mDreamsSupportedConfig
&& mDreamsEnabledSetting
- && mDreamsActivateOnSleepSetting
- && !mBatteryService.isBatteryLow();
+ && mDisplayPowerRequest.screenState != DisplayPowerRequest.SCREEN_STATE_OFF;
}
/**
@@ -1313,7 +1319,6 @@
}
}
-
/**
* Updates the display power state asynchronously.
* When the update is finished, mDisplayReady will be set to true. The display
@@ -1494,15 +1499,6 @@
updatePowerStateLocked();
}
- private void handleDockStateChangedLocked(int dockState) {
- // TODO
- }
-
- private void handleDreamEndedLocked() {
- mDirty |= DIRTY_DREAM_ENDED;
- updatePowerStateLocked();
- }
-
/**
* Reboot the device immediately, passing 'reason' (may be null)
* to the underlying __reboot system call. Should not return.
@@ -1957,22 +1953,11 @@
}
}
- private final class DockReceiver extends BroadcastReceiver {
- @Override
- public void onReceive(Context context, Intent intent) {
- synchronized (mLock) {
- int dockState = intent.getIntExtra(Intent.EXTRA_DOCK_STATE,
- Intent.EXTRA_DOCK_STATE_UNDOCKED);
- handleDockStateChangedLocked(dockState);
- }
- }
- }
-
private final class DreamReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
synchronized (mLock) {
- handleDreamEndedLocked();
+ scheduleSandmanLocked();
}
}
}
diff --git a/services/tests/servicestests/src/com/android/server/ThrottleServiceTest.java b/services/tests/servicestests/src/com/android/server/ThrottleServiceTest.java
index afa0eec..569acee 100644
--- a/services/tests/servicestests/src/com/android/server/ThrottleServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/ThrottleServiceTest.java
@@ -242,9 +242,9 @@
*/
public void setThrottlePolicy(long thresholdBytes, int valueKbitps, int resetDay) {
final ContentResolver resolver = getContext().getContentResolver();
- Settings.Secure.putLong(resolver, Settings.Secure.THROTTLE_THRESHOLD_BYTES, thresholdBytes);
- Settings.Secure.putInt(resolver, Settings.Secure.THROTTLE_VALUE_KBITSPS, valueKbitps);
- Settings.Secure.putInt(resolver, Settings.Secure.THROTTLE_RESET_DAY, resetDay);
+ Settings.Global.putLong(resolver, Settings.Global.THROTTLE_THRESHOLD_BYTES, thresholdBytes);
+ Settings.Global.putInt(resolver, Settings.Global.THROTTLE_VALUE_KBITSPS, valueKbitps);
+ Settings.Global.putInt(resolver, Settings.Global.THROTTLE_RESET_DAY, resetDay);
}
/**
@@ -252,9 +252,9 @@
*/
public void clearThrottlePolicy() {
final ContentResolver resolver = getContext().getContentResolver();
- Settings.Secure.putString(resolver, Settings.Secure.THROTTLE_THRESHOLD_BYTES, null);
- Settings.Secure.putString(resolver, Settings.Secure.THROTTLE_VALUE_KBITSPS, null);
- Settings.Secure.putString(resolver, Settings.Secure.THROTTLE_RESET_DAY, null);
+ Settings.Global.putString(resolver, Settings.Global.THROTTLE_THRESHOLD_BYTES, null);
+ Settings.Global.putString(resolver, Settings.Global.THROTTLE_VALUE_KBITSPS, null);
+ Settings.Global.putString(resolver, Settings.Global.THROTTLE_RESET_DAY, null);
}
/**
diff --git a/tests/ActivityTests/AndroidManifest.xml b/tests/ActivityTests/AndroidManifest.xml
index 9dfe4a1..15d075c 100644
--- a/tests/ActivityTests/AndroidManifest.xml
+++ b/tests/ActivityTests/AndroidManifest.xml
@@ -21,6 +21,8 @@
<uses-permission android:name="android.permission.REMOVE_TASKS" />
<uses-permission android:name="android.permission.READ_FRAME_BUFFER" />
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
+ <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" />
+ <uses-permission android:name="android.permission.MANAGE_USERS" />
<application android:label="ActivityTest">
<activity android:name="ActivityTestMain">
<intent-filter>
@@ -31,6 +33,8 @@
<service android:name="SingleUserService"
android:singleUser="true" android:exported="true">
</service>
+ <service android:name="ServiceUserTarget">
+ </service>
<receiver android:name="UserTarget">
</receiver>
<receiver android:name="SingleUserReceiver"
diff --git a/tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java b/tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java
index 2348e99..f0c3b22 100644
--- a/tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java
+++ b/tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java
@@ -16,6 +16,7 @@
package com.google.android.test.activity;
+import java.util.ArrayList;
import java.util.List;
import android.app.Activity;
@@ -31,6 +32,7 @@
import android.os.IBinder;
import android.os.RemoteException;
import android.os.UserHandle;
+import android.os.UserManager;
import android.graphics.Bitmap;
import android.widget.ImageView;
import android.widget.LinearLayout;
@@ -41,6 +43,7 @@
import android.view.MenuItem;
import android.view.View;
import android.content.Context;
+import android.content.pm.UserInfo;
import android.content.res.Configuration;
import android.util.Log;
@@ -51,6 +54,9 @@
ActivityManager mAm;
Configuration mOverrideConfig;
+ int mSecondUser;
+
+ ArrayList<ServiceConnection> mConnections = new ArrayList<ServiceConnection>();
class BroadcastResultReceiver extends BroadcastReceiver {
@Override
@@ -122,6 +128,15 @@
applyOverrideConfiguration(mOverrideConfig);
}
}
+
+ UserManager um = (UserManager)getSystemService(Context.USER_SERVICE);
+ List<UserInfo> users = um.getUsers();
+ mSecondUser = Integer.MAX_VALUE;
+ for (UserInfo ui : users) {
+ if (ui.id != 0 && mSecondUser > ui.id) {
+ mSecondUser = ui.id;
+ }
+ }
}
@Override
@@ -148,7 +163,12 @@
Log.i(TAG, "Service disconnected " + name);
}
};
- bindService(intent, conn, Context.BIND_AUTO_CREATE);
+ if (bindService(intent, conn, Context.BIND_AUTO_CREATE)) {
+ mConnections.add(conn);
+ } else {
+ Toast.makeText(ActivityTestMain.this, "Failed to bind",
+ Toast.LENGTH_LONG).show();
+ }
return true;
}
});
@@ -185,15 +205,70 @@
return true;
}
});
- menu.add("Send to user 1!").setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
+ menu.add("Send to user 0!").setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override public boolean onMenuItemClick(MenuItem item) {
Intent intent = new Intent(ActivityTestMain.this, UserTarget.class);
- sendOrderedBroadcastAsUser(intent, new UserHandle(1), null,
+ sendOrderedBroadcastAsUser(intent, new UserHandle(0), null,
+ new BroadcastResultReceiver(),
+ null, Activity.RESULT_OK, null, null);
+ return true;
+ }
+ });
+ menu.add("Send to user " + mSecondUser + "!").setOnMenuItemClickListener(
+ new MenuItem.OnMenuItemClickListener() {
+ @Override public boolean onMenuItemClick(MenuItem item) {
+ Intent intent = new Intent(ActivityTestMain.this, UserTarget.class);
+ sendOrderedBroadcastAsUser(intent, new UserHandle(mSecondUser), null,
new BroadcastResultReceiver(),
null, Activity.RESULT_OK, null, null);
return true;
}
});
+ menu.add("Bind to user 0!").setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
+ @Override public boolean onMenuItemClick(MenuItem item) {
+ Intent intent = new Intent(ActivityTestMain.this, ServiceUserTarget.class);
+ ServiceConnection conn = new ServiceConnection() {
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ Log.i(TAG, "Service connected " + name + " " + service);
+ }
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ Log.i(TAG, "Service disconnected " + name);
+ }
+ };
+ if (bindService(intent, conn, Context.BIND_AUTO_CREATE, 0)) {
+ mConnections.add(conn);
+ } else {
+ Toast.makeText(ActivityTestMain.this, "Failed to bind",
+ Toast.LENGTH_LONG).show();
+ }
+ return true;
+ }
+ });
+ menu.add("Bind to user " + mSecondUser + "!").setOnMenuItemClickListener(
+ new MenuItem.OnMenuItemClickListener() {
+ @Override public boolean onMenuItemClick(MenuItem item) {
+ Intent intent = new Intent(ActivityTestMain.this, ServiceUserTarget.class);
+ ServiceConnection conn = new ServiceConnection() {
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ Log.i(TAG, "Service connected " + name + " " + service);
+ }
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ Log.i(TAG, "Service disconnected " + name);
+ }
+ };
+ if (bindService(intent, conn, Context.BIND_AUTO_CREATE, mSecondUser)) {
+ mConnections.add(conn);
+ } else {
+ Toast.makeText(ActivityTestMain.this, "Failed to bind",
+ Toast.LENGTH_LONG).show();
+ }
+ return true;
+ }
+ });
menu.add("Density!").setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override public boolean onMenuItemClick(MenuItem item) {
if (mOverrideConfig == null) {
@@ -226,6 +301,15 @@
}
}
+ @Override
+ protected void onStop() {
+ super.onStop();
+ for (ServiceConnection conn : mConnections) {
+ unbindService(conn);
+ }
+ mConnections.clear();
+ }
+
private View scrollWrap(View view) {
ScrollView scroller = new ScrollView(this);
scroller.addView(view, new ScrollView.LayoutParams(ScrollView.LayoutParams.MATCH_PARENT,
diff --git a/tests/ActivityTests/src/com/google/android/test/activity/ServiceUserTarget.java b/tests/ActivityTests/src/com/google/android/test/activity/ServiceUserTarget.java
new file mode 100644
index 0000000..a7474ec
--- /dev/null
+++ b/tests/ActivityTests/src/com/google/android/test/activity/ServiceUserTarget.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.android.test.activity;
+
+import android.app.Service;
+import android.content.Intent;
+import android.os.Binder;
+import android.os.IBinder;
+import android.os.UserHandle;
+import android.widget.Toast;
+
+public class ServiceUserTarget extends Service {
+ Binder mBinder = new Binder();
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ Toast.makeText(this,
+ "Service created as user " + UserHandle.myUserId(),
+ Toast.LENGTH_LONG).show();
+ }
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ return mBinder;
+ }
+}
diff --git a/tests/ActivityTests/src/com/google/android/test/activity/SingleUserService.java b/tests/ActivityTests/src/com/google/android/test/activity/SingleUserService.java
index c40582a..e9c340f 100644
--- a/tests/ActivityTests/src/com/google/android/test/activity/SingleUserService.java
+++ b/tests/ActivityTests/src/com/google/android/test/activity/SingleUserService.java
@@ -20,11 +20,21 @@
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
+import android.os.UserHandle;
+import android.widget.Toast;
public class SingleUserService extends Service {
Binder mBinder = new Binder();
@Override
+ public void onCreate() {
+ super.onCreate();
+ Toast.makeText(this,
+ "Service created as user " + UserHandle.myUserId(),
+ Toast.LENGTH_LONG).show();
+ }
+
+ @Override
public IBinder onBind(Intent intent) {
return mBinder;
}
diff --git a/tests/RenderScriptTests/ImageProcessing/res/layout/main.xml b/tests/RenderScriptTests/ImageProcessing/res/layout/main.xml
index 4715d6e..f0a2b92 100644
--- a/tests/RenderScriptTests/ImageProcessing/res/layout/main.xml
+++ b/tests/RenderScriptTests/ImageProcessing/res/layout/main.xml
@@ -54,6 +54,10 @@
android:id="@+id/filterselection"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
+ <Spinner
+ android:id="@+id/spinner1"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"/>
<TextView
android:id="@+id/slider1Text"
android:layout_width="match_parent"
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Blend.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Blend.java
new file mode 100644
index 0000000..2920824
--- /dev/null
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Blend.java
@@ -0,0 +1,176 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.rs.image;
+
+import java.lang.Math;
+import java.lang.Short;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.Matrix4f;
+import android.renderscript.RenderScript;
+import android.renderscript.Script;
+import android.renderscript.ScriptC;
+import android.renderscript.ScriptGroup;
+import android.renderscript.ScriptIntrinsicBlend;
+import android.renderscript.Type;
+import android.util.Log;
+import android.widget.SeekBar;
+import android.widget.TextView;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.view.View;
+import android.widget.Spinner;
+
+public class Blend extends TestBase {
+ private ScriptIntrinsicBlend mBlend;
+ private ScriptC_blend mBlendHelper;
+ private short image1Alpha = 128;
+ private short image2Alpha = 128;
+
+ String mIntrinsicNames[];
+
+ private Allocation image1;
+ private Allocation image2;
+ private int currentIntrinsic = 0;
+
+ private AdapterView.OnItemSelectedListener mIntrinsicSpinnerListener =
+ new AdapterView.OnItemSelectedListener() {
+ public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
+ currentIntrinsic = pos;
+ runTest();
+ act.updateDisplay();
+ }
+
+ public void onNothingSelected(AdapterView parent) {
+
+ }
+ };
+
+ public void createTest(android.content.res.Resources res) {
+ mBlend = ScriptIntrinsicBlend.create(mRS, Element.U8_4(mRS));
+ mBlendHelper = new ScriptC_blend(mRS);
+ mBlendHelper.set_alpha((short)128);
+
+ image1 = Allocation.createTyped(mRS, mInPixelsAllocation.getType());
+ image2 = Allocation.createTyped(mRS, mInPixelsAllocation2.getType());
+
+ mIntrinsicNames = new String[14];
+ mIntrinsicNames[0] = "Source";
+ mIntrinsicNames[1] = "Destination";
+ mIntrinsicNames[2] = "Source Over";
+ mIntrinsicNames[3] = "Destination Over";
+ mIntrinsicNames[4] = "Source In";
+ mIntrinsicNames[5] = "Destination In";
+ mIntrinsicNames[6] = "Source Out";
+ mIntrinsicNames[7] = "Destination Out";
+ mIntrinsicNames[8] = "Source Atop";
+ mIntrinsicNames[9] = "Destination Atop";
+ mIntrinsicNames[10] = "XOR";
+ mIntrinsicNames[11] = "Add";
+ mIntrinsicNames[12] = "Subtract";
+ mIntrinsicNames[13] = "Multiply";
+ }
+
+ public boolean onSpinner1Setup(Spinner s) {
+ s.setAdapter(new ArrayAdapter<String>(
+ act, R.layout.spinner_layout, mIntrinsicNames));
+ s.setOnItemSelectedListener(mIntrinsicSpinnerListener);
+ return true;
+ }
+
+ public boolean onBar1Setup(SeekBar b, TextView t) {
+ t.setText("Image 1 Alpha");
+ b.setMax(255);
+ b.setProgress(image1Alpha);
+ return true;
+ }
+
+ public void onBar1Changed(int progress) {
+ image1Alpha = (short)progress;
+ }
+
+ public boolean onBar2Setup(SeekBar b, TextView t) {
+ t.setText("Image 2 Alpha");
+ b.setMax(255);
+ b.setProgress(image2Alpha);
+ return true;
+ }
+
+ public void onBar2Changed(int progress) {
+ image2Alpha = (short)progress;
+ }
+
+ public void runTest() {
+ image1.copy2DRangeFrom(0, 0, mInPixelsAllocation.getType().getX(), mInPixelsAllocation.getType().getY(), mInPixelsAllocation, 0, 0);
+ image2.copy2DRangeFrom(0, 0, mInPixelsAllocation2.getType().getX(), mInPixelsAllocation2.getType().getY(), mInPixelsAllocation2, 0, 0);
+
+ mBlendHelper.set_alpha(image1Alpha);
+ mBlendHelper.forEach_setImageAlpha(image1);
+
+ mBlendHelper.set_alpha(image2Alpha);
+ mBlendHelper.forEach_setImageAlpha(image2);
+
+ switch (currentIntrinsic) {
+ case 0:
+ mBlend.forEachSrc(image1, image2);
+ break;
+ case 1:
+ mBlend.forEachDst(image1, image2);
+ break;
+ case 2:
+ mBlend.forEachSrcOver(image1, image2);
+ break;
+ case 3:
+ mBlend.forEachDstOver(image1, image2);
+ break;
+ case 4:
+ mBlend.forEachSrcIn(image1, image2);
+ break;
+ case 5:
+ mBlend.forEachDstIn(image1, image2);
+ break;
+ case 6:
+ mBlend.forEachSrcOut(image1, image2);
+ break;
+ case 7:
+ mBlend.forEachDstOut(image1, image2);
+ break;
+ case 8:
+ mBlend.forEachSrcAtop(image1, image2);
+ break;
+ case 9:
+ mBlend.forEachDstAtop(image1, image2);
+ break;
+ case 10:
+ mBlend.forEachXor(image1, image2);
+ break;
+ case 11:
+ mBlend.forEachAdd(image1, image2);
+ break;
+ case 12:
+ mBlend.forEachSubtract(image1, image2);
+ break;
+ case 13:
+ mBlend.forEachMultiply(image1, image2);
+ break;
+ }
+
+ mOutPixelsAllocation.copy2DRangeFrom(0, 0, image2.getType().getX(), image2.getType().getY(), image2, 0, 0);
+ }
+
+}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java
index a8462e6..db0ef78 100644
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java
@@ -55,9 +55,11 @@
private final String RESULT_FILE = "image_processing_result.csv";
Bitmap mBitmapIn;
+ Bitmap mBitmapIn2;
Bitmap mBitmapOut;
String mTestNames[];
+ private Spinner mSpinner;
private SeekBar mBar1;
private SeekBar mBar2;
private SeekBar mBar3;
@@ -81,6 +83,10 @@
private TestBase mTest;
+ public void updateDisplay() {
+ mTest.updateBitmap(mBitmapOut);
+ mDisplayView.invalidate();
+ }
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (fromUser) {
@@ -98,8 +104,7 @@
}
mTest.runTest();
- mTest.updateBitmap(mBitmapOut);
- mDisplayView.invalidate();
+ updateDisplay();
}
}
@@ -110,6 +115,9 @@
}
void setupBars() {
+ mSpinner.setVisibility(View.VISIBLE);
+ mTest.onSpinner1Setup(mSpinner);
+
mBar1.setVisibility(View.VISIBLE);
mText1.setVisibility(View.VISIBLE);
mTest.onBar1Setup(mBar1, mText1);
@@ -221,19 +229,21 @@
case 27:
mTest = new Mandelbrot();
break;
+ case 28:
+ mTest = new Blend();
+ break;
}
- mTest.createBaseTest(this, mBitmapIn);
+ mTest.createBaseTest(this, mBitmapIn, mBitmapIn2);
setupBars();
mTest.runTest();
- mTest.updateBitmap(mBitmapOut);
- mDisplayView.invalidate();
+ updateDisplay();
mBenchmarkResult.setText("Result: not run");
}
void setupTests() {
- mTestNames = new String[28];
+ mTestNames = new String[29];
mTestNames[0] = "Levels Vec3 Relaxed";
mTestNames[1] = "Levels Vec4 Relaxed";
mTestNames[2] = "Levels Vec3 Full";
@@ -262,6 +272,7 @@
mTestNames[25] = "Convolve 5x5";
mTestNames[26] = "Intrinsics Convolve 5x5";
mTestNames[27] = "Mandelbrot";
+ mTestNames[28] = "Intrinsics Blend";
mTestSpinner.setAdapter(new ArrayAdapter<String>(
this, R.layout.spinner_layout, mTestNames));
@@ -284,6 +295,7 @@
setContentView(R.layout.main);
mBitmapIn = loadBitmap(R.drawable.img1600x1067);
+ mBitmapIn2 = loadBitmap(R.drawable.img1600x1067b);
mBitmapOut = loadBitmap(R.drawable.img1600x1067);
mSurfaceView = (SurfaceView) findViewById(R.id.surface);
@@ -291,6 +303,8 @@
mDisplayView = (ImageView) findViewById(R.id.display);
mDisplayView.setImageBitmap(mBitmapOut);
+ mSpinner = (Spinner) findViewById(R.id.spinner1);
+
mBar1 = (SeekBar) findViewById(R.id.slider1);
mBar2 = (SeekBar) findViewById(R.id.slider2);
mBar3 = (SeekBar) findViewById(R.id.slider3);
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/TestBase.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/TestBase.java
index 6885181..8009daa 100644
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/TestBase.java
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/TestBase.java
@@ -36,14 +36,18 @@
import android.view.View;
import android.util.Log;
import java.lang.Math;
+import android.widget.Spinner;
public class TestBase {
protected final String TAG = "Img";
protected RenderScript mRS;
protected Allocation mInPixelsAllocation;
+ protected Allocation mInPixelsAllocation2;
protected Allocation mOutPixelsAllocation;
+ protected ImageProcessingActivity act;
+
// Override to use UI elements
public void onBar1Changed(int progress) {
}
@@ -84,11 +88,20 @@
return false;
}
- public final void createBaseTest(ImageProcessingActivity act, Bitmap b) {
+ public boolean onSpinner1Setup(Spinner s) {
+ s.setVisibility(View.INVISIBLE);
+ return false;
+ }
+
+ public final void createBaseTest(ImageProcessingActivity ipact, Bitmap b, Bitmap b2) {
+ act = ipact;
mRS = RenderScript.create(act);
mInPixelsAllocation = Allocation.createFromBitmap(mRS, b,
Allocation.MipmapControl.MIPMAP_NONE,
Allocation.USAGE_SCRIPT);
+ mInPixelsAllocation2 = Allocation.createFromBitmap(mRS, b2,
+ Allocation.MipmapControl.MIPMAP_NONE,
+ Allocation.USAGE_SCRIPT);
mOutPixelsAllocation = Allocation.createFromBitmap(mRS, b,
Allocation.MipmapControl.MIPMAP_NONE,
Allocation.USAGE_SCRIPT);
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/blend.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/blend.rs
new file mode 100644
index 0000000..87b56f77
--- /dev/null
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/blend.rs
@@ -0,0 +1,24 @@
+// Copyright (C) 2011 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#pragma version(1)
+#pragma rs java_package_name(com.android.rs.image)
+
+uchar alpha = 0x0;
+
+void setImageAlpha(uchar4 *v_out, uint32_t x, uint32_t y) {
+ v_out->rgba = convert_uchar4((convert_uint4(v_out->rgba) * alpha) >> (uint4)8);
+ v_out->a = alpha;
+}
+
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/RSTestCore.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/RSTestCore.java
index 83fadcb..7662007 100644
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/RSTestCore.java
+++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/RSTestCore.java
@@ -72,6 +72,7 @@
unitTests.add(new UT_array_alloc(this, mRes, mCtx));
unitTests.add(new UT_kernel(this, mRes, mCtx));
unitTests.add(new UT_kernel_struct(this, mRes, mCtx));
+ unitTests.add(new UT_bug_char(this, mRes, mCtx));
unitTests.add(new UT_clamp(this, mRes, mCtx));
unitTests.add(new UT_clamp_relaxed(this, mRes, mCtx));
unitTests.add(new UT_convert(this, mRes, mCtx));
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_bug_char.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_bug_char.java
new file mode 100644
index 0000000..faf3a31
--- /dev/null
+++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_bug_char.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.rs.test;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.renderscript.*;
+import android.util.Log;
+import java.util.Arrays;
+
+public class UT_bug_char extends UnitTest {
+ private Resources mRes;
+
+ protected UT_bug_char(RSTestCore rstc, Resources res, Context ctx) {
+ super(rstc, "Bug Char", ctx);
+ mRes = res;
+ }
+
+ // packing functions
+ private Byte2 pack_b2(byte[] val) {
+ assert val.length == 2;
+ Log.i("bug_char", "pack_b2 " + val[0] + " " + val[1]);
+ return new Byte2(val[0], val[1]);
+ }
+
+ private byte min(byte v1, byte v2) {
+ return v1 < v2 ? v1 : v2;
+ }
+ private byte[] min(byte[] v1, byte[] v2) {
+ assert v1.length == v2.length;
+ byte[] rv = new byte[v1.length];
+ for (int i = 0; i < v1.length; ++i)
+ rv[i] = min(v1[i], v2[i]);
+ return rv;
+ }
+
+ private void initializeValues(ScriptC_bug_char s) {
+ byte rand_sc1_0 = (byte)7;
+ byte[] rand_sc2_0 = new byte[2];
+ rand_sc2_0[0] = 11;
+ rand_sc2_0[1] = 21;
+ Log.i("bug_char", "Generated sc2_0 to " + Arrays.toString(rand_sc2_0));
+ byte rand_sc1_1 = (byte)10;
+ byte[] rand_sc2_1 = new byte[2];
+ rand_sc2_1[0] = 13;
+ rand_sc2_1[1] = 15;
+ Log.i("bug_char", "Generated sc2_1 to " + Arrays.toString(rand_sc2_1));
+
+ s.set_rand_sc1_0(rand_sc1_0);
+ s.set_rand_sc2_0(pack_b2(rand_sc2_0));
+ s.set_rand_sc1_1(rand_sc1_1);
+ s.set_rand_sc2_1(pack_b2(rand_sc2_1));
+ // Set results for min
+ s.set_min_rand_sc1_sc1(min(rand_sc1_0, rand_sc1_1));
+ byte[] min_rand_sc2_raw = min(rand_sc2_0, rand_sc2_1);
+ Log.i("bug_char", "Generating min_rand_sc2_sc2 to " +
+ Arrays.toString(min_rand_sc2_raw));
+ Byte2 min_rand_sc2 = pack_b2(min_rand_sc2_raw);
+ Log.i("bug_char", "Setting min_rand_sc2_sc2 to [" + min_rand_sc2.x +
+ ", " + min_rand_sc2.y + "]");
+ s.set_min_rand_sc2_sc2(min_rand_sc2);
+ }
+
+ public void run() {
+ RenderScript pRS = RenderScript.create(mCtx);
+ ScriptC_bug_char s = new ScriptC_bug_char(pRS, mRes,
+ R.raw.bug_char);
+ pRS.setMessageHandler(mRsMessage);
+ initializeValues(s);
+ s.invoke_bug_char_test();
+ pRS.finish();
+ waitForMessage();
+ pRS.destroy();
+ }
+}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_math_agree.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_math_agree.java
index 40f7213..220509c 100644
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_math_agree.java
+++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_math_agree.java
@@ -347,8 +347,6 @@
long[] rand_sl2_1 = randvec_long(2);
long[] rand_sl3_1 = randvec_long(3);
long[] rand_sl4_1 = randvec_long(4);
- // FIXME: generate signed char vectors once bug 6865598 is fixed
- /*
byte rand_sc1_0 = (byte)rand.nextInt(0x1 << 8);
byte[] rand_sc2_0 = randvec_char(2);
byte[] rand_sc3_0 = randvec_char(3);
@@ -357,7 +355,6 @@
byte[] rand_sc2_1 = randvec_char(2);
byte[] rand_sc3_1 = randvec_char(3);
byte[] rand_sc4_1 = randvec_char(4);
- */
// TODO: generate unsigned long vectors
// Set random vectors in renderscript code
@@ -417,8 +414,6 @@
s.set_rand_uc2_0(pack_s2(rand_uc2_0));
s.set_rand_uc3_0(pack_s3(rand_uc3_0));
s.set_rand_uc4_0(pack_s4(rand_uc4_0));
- // FIXME: set char input vectors once bug 6865598 is fixed
- /*
s.set_rand_sc1_0(rand_sc1_0);
s.set_rand_sc2_0(pack_b2(rand_sc2_0));
s.set_rand_sc3_0(pack_b3(rand_sc3_0));
@@ -427,7 +422,6 @@
s.set_rand_sc2_1(pack_b2(rand_sc2_1));
s.set_rand_sc3_1(pack_b3(rand_sc3_1));
s.set_rand_sc4_1(pack_b4(rand_sc4_1));
- */
// TODO: set unsigned long vectors
// Set results for min
@@ -459,13 +453,10 @@
s.set_min_rand_sl2_sl2(pack_l2(min(rand_sl2_0, rand_sl2_1)));
s.set_min_rand_sl3_sl3(pack_l3(min(rand_sl3_0, rand_sl3_1)));
s.set_min_rand_sl4_sl4(pack_l4(min(rand_sl4_0, rand_sl4_1)));
- // FIXME: set char min reference vectors once bug 6865598 is fixed
- /*
s.set_min_rand_sc1_sc1(min(rand_sc1_0, rand_sc1_1));
s.set_min_rand_sc2_sc2(pack_b2(min(rand_sc2_0, rand_sc2_1)));
s.set_min_rand_sc3_sc3(pack_b3(min(rand_sc3_0, rand_sc3_1)));
s.set_min_rand_sc4_sc4(pack_b4(min(rand_sc4_0, rand_sc4_1)));
- */
// TODO: set results for unsigned long min
// Set results for max
@@ -497,13 +488,10 @@
s.set_max_rand_sl2_sl2(pack_l2(max(rand_sl2_0, rand_sl2_1)));
s.set_max_rand_sl3_sl3(pack_l3(max(rand_sl3_0, rand_sl3_1)));
s.set_max_rand_sl4_sl4(pack_l4(max(rand_sl4_0, rand_sl4_1)));
- // FIXME: set signed char max reference vectors once bug 6865598 is fixed
- /*
s.set_max_rand_sc1_sc1(max(rand_sc1_0, rand_sc1_1));
s.set_max_rand_sc2_sc2(pack_b2(max(rand_sc2_0, rand_sc2_1)));
s.set_max_rand_sc3_sc3(pack_b3(max(rand_sc3_0, rand_sc3_1)));
s.set_max_rand_sc4_sc4(pack_b4(max(rand_sc4_0, rand_sc4_1)));
- */
// TODO: set results for unsigned long max
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/bug_char.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/bug_char.rs
new file mode 100644
index 0000000..dcd7b72
--- /dev/null
+++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/bug_char.rs
@@ -0,0 +1,47 @@
+#include "shared.rsh"
+
+char rand_sc1_0, rand_sc1_1;
+char2 rand_sc2_0, rand_sc2_1;
+
+char min_rand_sc1_sc1;
+char2 min_rand_sc2_sc2;
+
+static bool test_bug_char() {
+ bool failed = false;
+
+ rsDebug("rand_sc2_0.x: ", rand_sc2_0.x);
+ rsDebug("rand_sc2_0.y: ", rand_sc2_0.y);
+ rsDebug("rand_sc2_1.x: ", rand_sc2_1.x);
+ rsDebug("rand_sc2_1.y: ", rand_sc2_1.y);
+ char temp_sc1;
+ char2 temp_sc2;
+
+ temp_sc1 = min( rand_sc1_0, rand_sc1_1 );
+ if (temp_sc1 != min_rand_sc1_sc1) {
+ rsDebug("temp_sc1", temp_sc1);
+ failed = true;
+ }
+ rsDebug("broken", 'y');
+
+ temp_sc2 = min( rand_sc2_0, rand_sc2_1 );
+ if (temp_sc2.x != min_rand_sc2_sc2.x
+ || temp_sc2.y != min_rand_sc2_sc2.y) {
+ failed = true;
+ }
+
+
+ return failed;
+}
+
+void bug_char_test() {
+ bool failed = false;
+ failed |= test_bug_char();
+
+ if (failed) {
+ rsSendToClientBlocking(RS_MSG_TEST_FAILED);
+ }
+ else {
+ rsSendToClientBlocking(RS_MSG_TEST_PASSED);
+ }
+}
+
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/math_agree.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/math_agree.rs
index 1adb036..5bfbb2b 100644
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/math_agree.rs
+++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/math_agree.rs
@@ -338,16 +338,13 @@
#define TEST_VEC_VEC_ALL(func) \
TEST_FN_FN_ALL(func) \
+TEST_SC_SC_ALL(func) \
TEST_UC_UC_ALL(func) \
TEST_SS_SS_ALL(func) \
TEST_US_US_ALL(func) \
TEST_SI_SI_ALL(func) \
TEST_UI_UI_ALL(func)
-// FIXME: Add char tests back in once bug 6865598 is fixed
-#if 0
-TEST_SC_SC_ALL(func)
-#endif
// TODO: add long types to ALL macro
#if 0
TEST_SL_SL_ALL(func) \
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java
index 0c85204..0cf0f21 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java
@@ -60,6 +60,11 @@
}
@Override
+ public void nap(long arg0) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
public void preventScreenOn(boolean arg0) throws RemoteException {
// pass for now.
}
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java
index e7927ae..ab9db88 100644
--- a/wifi/java/android/net/wifi/WifiStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiStateMachine.java
@@ -608,8 +608,8 @@
mPrimaryDeviceType = mContext.getResources().getString(
R.string.config_wifi_p2p_device_type);
- mUserWantsSuspendOpt.set(Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED, 1) == 1);
+ mUserWantsSuspendOpt.set(Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED, 1) == 1);
mContext.registerReceiver(
new BroadcastReceiver() {
@@ -659,13 +659,13 @@
},
new IntentFilter(ACTION_DELAYED_DRIVER_STOP));
- mContext.getContentResolver().registerContentObserver(Settings.Secure.getUriFor(
- Settings.Secure.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED), false,
+ mContext.getContentResolver().registerContentObserver(Settings.Global.getUriFor(
+ Settings.Global.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED), false,
new ContentObserver(getHandler()) {
@Override
public void onChange(boolean selfChange) {
- mUserWantsSuspendOpt.set(Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED, 1) == 1);
+ mUserWantsSuspendOpt.set(Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED, 1) == 1);
}
});
@@ -1074,8 +1074,8 @@
*/
public void setFrequencyBand(int band, boolean persist) {
if (persist) {
- Settings.Secure.putInt(mContext.getContentResolver(),
- Settings.Secure.WIFI_FREQUENCY_BAND,
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.WIFI_FREQUENCY_BAND,
band);
}
sendMessage(obtainMessage(CMD_SET_FREQUENCY_BAND, band, 0));
@@ -1331,8 +1331,8 @@
* Set the frequency band from the system setting value, if any.
*/
private void setFrequencyBand() {
- int band = Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.WIFI_FREQUENCY_BAND, WifiManager.WIFI_FREQUENCY_BAND_AUTO);
+ int band = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.WIFI_FREQUENCY_BAND, WifiManager.WIFI_FREQUENCY_BAND_AUTO);
setFrequencyBand(band, false);
}
diff --git a/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java b/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java
index 7fa6aac..4440145 100644
--- a/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java
@@ -343,13 +343,13 @@
// Watchdog is always enabled. Poor network detection can be seperately turned on/off
// TODO: Remove this setting & clean up state machine since we always have
// watchdog in an enabled state
- putSettingsBoolean(contentResolver, Settings.Secure.WIFI_WATCHDOG_ON, true);
+ putSettingsGlobalBoolean(contentResolver, Settings.Global.WIFI_WATCHDOG_ON, true);
// disable poor network avoidance
if (sWifiOnly) {
logd("Disabling poor network avoidance for wi-fi only device");
- putSettingsBoolean(contentResolver,
- Settings.Secure.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED, false);
+ putSettingsGlobalBoolean(contentResolver,
+ Settings.Global.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED, false);
}
WifiWatchdogStateMachine wwsm = new WifiWatchdogStateMachine(context);
@@ -402,7 +402,7 @@
};
mContext.getContentResolver().registerContentObserver(
- Settings.Secure.getUriFor(Settings.Secure.WIFI_WATCHDOG_ON),
+ Settings.Global.getUriFor(Settings.Global.WIFI_WATCHDOG_ON),
false, contentObserver);
}
@@ -418,7 +418,7 @@
};
mContext.getContentResolver().registerContentObserver(
- Settings.Secure.getUriFor(Settings.Secure.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED),
+ Settings.Global.getUriFor(Settings.Global.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED),
false, contentObserver);
}
@@ -432,7 +432,8 @@
}
private boolean isWatchdogEnabled() {
- boolean ret = getSettingsBoolean(mContentResolver, Settings.Secure.WIFI_WATCHDOG_ON, true);
+ boolean ret = getSettingsGlobalBoolean(
+ mContentResolver, Settings.Global.WIFI_WATCHDOG_ON, true);
if (DBG) logd("Watchdog enabled " + ret);
return ret;
}
@@ -440,8 +441,8 @@
private void updateSettings() {
if (DBG) logd("Updating secure settings");
- mPoorNetworkDetectionEnabled = getSettingsBoolean(mContentResolver,
- Settings.Secure.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED, true);
+ mPoorNetworkDetectionEnabled = getSettingsGlobalBoolean(mContentResolver,
+ Settings.Global.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED, true);
}
/**
@@ -927,21 +928,6 @@
}
/**
- * Convenience function for retrieving a single secure settings value
- * as a string with a default value.
- *
- * @param cr The ContentResolver to access.
- * @param name The name of the setting to retrieve.
- * @param def Value to return if the setting is not defined.
- *
- * @return The setting's current value, or 'def' if it is not defined
- */
- private static String getSettingsStr(ContentResolver cr, String name, String def) {
- String v = Settings.Secure.getString(cr, name);
- return v != null ? v : def;
- }
-
- /**
* Convenience function for retrieving a single secure settings value as a
* boolean. Note that internally setting values are always stored as
* strings; this function converts the string to a boolean for you. The
@@ -954,8 +940,8 @@
* @return The setting's current value, or 'def' if it is not defined or not
* a valid boolean.
*/
- private static boolean getSettingsBoolean(ContentResolver cr, String name, boolean def) {
- return Settings.Secure.getInt(cr, name, def ? 1 : 0) == 1;
+ private static boolean getSettingsGlobalBoolean(ContentResolver cr, String name, boolean def) {
+ return Settings.Global.getInt(cr, name, def ? 1 : 0) == 1;
}
/**
@@ -970,8 +956,8 @@
* @param value The new value for the setting.
* @return true if the value was set, false on database errors
*/
- private static boolean putSettingsBoolean(ContentResolver cr, String name, boolean value) {
- return Settings.Secure.putInt(cr, name, value ? 1 : 0);
+ private static boolean putSettingsGlobalBoolean(ContentResolver cr, String name, boolean value) {
+ return Settings.Global.putInt(cr, name, value ? 1 : 0);
}
private static void logd(String s) {
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pService.java b/wifi/java/android/net/wifi/p2p/WifiP2pService.java
index 8f0d8f0..8670650 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pService.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pService.java
@@ -2039,8 +2039,8 @@
}
private String getPersistedDeviceName() {
- String deviceName = Settings.Secure.getString(mContext.getContentResolver(),
- Settings.Secure.WIFI_P2P_DEVICE_NAME);
+ String deviceName = Settings.Global.getString(mContext.getContentResolver(),
+ Settings.Global.WIFI_P2P_DEVICE_NAME);
if (deviceName == null) {
/* We use the 4 digits of the ANDROID_ID to have a friendly
* default that has low likelihood of collision with a peer */
@@ -2062,8 +2062,8 @@
mThisDevice.deviceName = devName;
mWifiNative.setP2pSsidPostfix("-" + mThisDevice.deviceName);
- Settings.Secure.putString(mContext.getContentResolver(),
- Settings.Secure.WIFI_P2P_DEVICE_NAME, devName);
+ Settings.Global.putString(mContext.getContentResolver(),
+ Settings.Global.WIFI_P2P_DEVICE_NAME, devName);
sendThisDeviceChangedBroadcast();
return true;
}