summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/ContextImpl.java22
-rw-r--r--core/java/android/app/SharedPreferencesImpl.java3
-rw-r--r--core/java/android/app/StatusBarManager.java4
-rw-r--r--core/java/android/content/Intent.java3
-rw-r--r--core/java/android/content/SharedPreferences.java11
-rw-r--r--core/java/android/content/SyncManager.java6
-rw-r--r--core/java/android/view/View.java12
-rw-r--r--core/java/android/view/ViewGroup.java5
8 files changed, 55 insertions, 11 deletions
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index 3e1e358..95b6bed 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -77,6 +77,7 @@ import android.net.wifi.p2p.WifiP2pManager;
import android.nfc.NfcManager;
import android.os.Binder;
import android.os.Bundle;
+import android.os.Debug;
import android.os.DropBoxManager;
import android.os.Environment;
import android.os.FileUtils;
@@ -97,6 +98,7 @@ import android.telephony.TelephonyManager;
import android.content.ClipboardManager;
import android.util.AndroidRuntimeException;
import android.util.Log;
+import android.util.Slog;
import android.view.CompatibilityInfoHolder;
import android.view.ContextThemeWrapper;
import android.view.Display;
@@ -925,6 +927,7 @@ class ContextImpl extends Context {
@Override
public void startActivity(Intent intent) {
+ warnIfCallingFromSystemProcess();
startActivity(intent, null);
}
@@ -936,6 +939,7 @@ class ContextImpl extends Context {
@Override
public void startActivity(Intent intent, Bundle options) {
+ warnIfCallingFromSystemProcess();
if ((intent.getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0) {
throw new AndroidRuntimeException(
"Calling startActivity() from outside of an Activity "
@@ -962,6 +966,7 @@ class ContextImpl extends Context {
@Override
public void startActivities(Intent[] intents) {
+ warnIfCallingFromSystemProcess();
startActivities(intents, null);
}
@@ -981,6 +986,7 @@ class ContextImpl extends Context {
@Override
public void startActivities(Intent[] intents, Bundle options) {
+ warnIfCallingFromSystemProcess();
if ((intents[0].getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0) {
throw new AndroidRuntimeException(
"Calling startActivities() from outside of an Activity "
@@ -1023,6 +1029,7 @@ class ContextImpl extends Context {
@Override
public void sendBroadcast(Intent intent) {
+ warnIfCallingFromSystemProcess();
String resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
try {
intent.setAllowFds(false);
@@ -1036,6 +1043,7 @@ class ContextImpl extends Context {
@Override
public void sendBroadcast(Intent intent, String receiverPermission) {
+ warnIfCallingFromSystemProcess();
String resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
try {
intent.setAllowFds(false);
@@ -1050,6 +1058,7 @@ class ContextImpl extends Context {
@Override
public void sendOrderedBroadcast(Intent intent,
String receiverPermission) {
+ warnIfCallingFromSystemProcess();
String resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
try {
intent.setAllowFds(false);
@@ -1066,6 +1075,7 @@ class ContextImpl extends Context {
String receiverPermission, BroadcastReceiver resultReceiver,
Handler scheduler, int initialCode, String initialData,
Bundle initialExtras) {
+ warnIfCallingFromSystemProcess();
IIntentReceiver rd = null;
if (resultReceiver != null) {
if (mPackageInfo != null) {
@@ -1154,6 +1164,7 @@ class ContextImpl extends Context {
@Override
public void sendStickyBroadcast(Intent intent) {
+ warnIfCallingFromSystemProcess();
String resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
try {
intent.setAllowFds(false);
@@ -1170,6 +1181,7 @@ class ContextImpl extends Context {
BroadcastReceiver resultReceiver,
Handler scheduler, int initialCode, String initialData,
Bundle initialExtras) {
+ warnIfCallingFromSystemProcess();
IIntentReceiver rd = null;
if (resultReceiver != null) {
if (mPackageInfo != null) {
@@ -1337,11 +1349,13 @@ class ContextImpl extends Context {
@Override
public ComponentName startService(Intent service) {
+ warnIfCallingFromSystemProcess();
return startServiceAsUser(service, mUser);
}
@Override
public boolean stopService(Intent service) {
+ warnIfCallingFromSystemProcess();
return stopServiceAsUser(service, mUser);
}
@@ -1389,6 +1403,7 @@ class ContextImpl extends Context {
@Override
public boolean bindService(Intent service, ServiceConnection conn,
int flags) {
+ warnIfCallingFromSystemProcess();
return bindService(service, conn, flags, UserHandle.getUserId(Process.myUid()));
}
@@ -1697,6 +1712,13 @@ class ContextImpl extends Context {
message);
}
+ private void warnIfCallingFromSystemProcess() {
+ if (Process.myUid() == Process.SYSTEM_UID) {
+ Slog.w(TAG, "Calling a method in the system process without a qualified user: "
+ + Debug.getCallers(3));
+ }
+ }
+
@Override
public Context createPackageContext(String packageName, int flags)
throws NameNotFoundException {
diff --git a/core/java/android/app/SharedPreferencesImpl.java b/core/java/android/app/SharedPreferencesImpl.java
index 201d7b2..86fd7b9 100644
--- a/core/java/android/app/SharedPreferencesImpl.java
+++ b/core/java/android/app/SharedPreferencesImpl.java
@@ -312,7 +312,8 @@ final class SharedPreferencesImpl implements SharedPreferences {
}
public Editor putStringSet(String key, Set<String> values) {
synchronized (this) {
- mModified.put(key, values);
+ mModified.put(key,
+ (values == null) ? null : new HashSet<String>(values));
return this;
}
}
diff --git a/core/java/android/app/StatusBarManager.java b/core/java/android/app/StatusBarManager.java
index 3d656c7..829b80c 100644
--- a/core/java/android/app/StatusBarManager.java
+++ b/core/java/android/app/StatusBarManager.java
@@ -45,6 +45,7 @@ public class StatusBarManager {
public static final int DISABLE_RECENT = View.STATUS_BAR_DISABLE_RECENT;
public static final int DISABLE_BACK = View.STATUS_BAR_DISABLE_BACK;
public static final int DISABLE_CLOCK = View.STATUS_BAR_DISABLE_CLOCK;
+ public static final int DISABLE_SEARCH = View.STATUS_BAR_DISABLE_SEARCH;
@Deprecated
public static final int DISABLE_NAVIGATION =
@@ -54,7 +55,8 @@ public class StatusBarManager {
public static final int DISABLE_MASK = DISABLE_EXPAND | DISABLE_NOTIFICATION_ICONS
| DISABLE_NOTIFICATION_ALERTS | DISABLE_NOTIFICATION_TICKER
- | DISABLE_SYSTEM_INFO | DISABLE_RECENT | DISABLE_HOME | DISABLE_BACK | DISABLE_CLOCK;
+ | DISABLE_SYSTEM_INFO | DISABLE_RECENT | DISABLE_HOME | DISABLE_BACK | DISABLE_CLOCK
+ | DISABLE_SEARCH;
public static final int NAVIGATION_HINT_BACK_NOP = 1 << 0;
public static final int NAVIGATION_HINT_HOME_NOP = 1 << 1;
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 97d299a..cf0603e 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -2430,7 +2430,8 @@ public class Intent implements Parcelable, Cloneable {
/**
* Broadcast sent to the system when a user is removed. Carries an extra EXTRA_USER_HANDLE that has
* the userHandle of the user. It is sent to all running users except the
- * one that has been removed. You must hold
+ * one that has been removed. The user will not be completely removed until all receivers have
+ * handled the broadcast. You must hold
* {@link android.Manifest.permission#MANAGE_USERS} to receive this broadcast.
* @hide
*/
diff --git a/core/java/android/content/SharedPreferences.java b/core/java/android/content/SharedPreferences.java
index bdc38d6..da5480e 100644
--- a/core/java/android/content/SharedPreferences.java
+++ b/core/java/android/content/SharedPreferences.java
@@ -25,7 +25,8 @@ import java.util.Set;
* there is a single instance of this class that all clients share.
* Modifications to the preferences must go through an {@link Editor} object
* to ensure the preference values remain in a consistent state and control
- * when they are committed to storage.
+ * when they are committed to storage. Objects that are returned from the
+ * various <code>get</code> methods must be treated as immutable by the application.
*
* <p><em>Note: currently this class does not support use across multiple
* processes. This will be added later.</em>
@@ -226,6 +227,10 @@ public interface SharedPreferences {
/**
* Retrieve all values from the preferences.
*
+ * <p>Note that you <em>must not</em> modify the collection returned
+ * by this method, or alter any of its contents. The consistency of your
+ * stored data is not guaranteed if you do.
+ *
* @return Returns a map containing a list of pairs key/value representing
* the preferences.
*
@@ -250,6 +255,10 @@ public interface SharedPreferences {
/**
* Retrieve a set of String values from the preferences.
*
+ * <p>Note that you <em>must not</em> modify the set instance returned
+ * by this call. The consistency of the stored data is not guaranteed
+ * if you do, nor is your ability to modify the instance at all.
+ *
* @param key The name of the preference to retrieve.
* @param defValues Values to return if this preference does not exist.
*
diff --git a/core/java/android/content/SyncManager.java b/core/java/android/content/SyncManager.java
index bb0c686..977b461 100644
--- a/core/java/android/content/SyncManager.java
+++ b/core/java/android/content/SyncManager.java
@@ -265,7 +265,9 @@ public class SyncManager {
}
private void doDatabaseCleanup() {
- for (UserInfo user : mUserManager.getUsers()) {
+ for (UserInfo user : mUserManager.getUsers(true)) {
+ // Skip any partially created/removed users
+ if (user.partial) continue;
Account[] accountsForUser = AccountManagerService.getSingleton().getAccounts(user.id);
mSyncStorageEngine.doDatabaseCleanup(accountsForUser, user.id);
}
@@ -2528,7 +2530,7 @@ public class SyncManager {
syncStateIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
syncStateIntent.putExtra("active", mNeedSyncActiveNotification);
syncStateIntent.putExtra("failing", false);
- mContext.sendBroadcast(syncStateIntent);
+ mContext.sendBroadcastAsUser(syncStateIntent, UserHandle.OWNER);
}
private void installHandleTooManyDeletesNotification(Account account, String authority,
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index b36db7f..f5e259e 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -2452,6 +2452,17 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
/**
* @hide
+ *
+ * NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked
+ * out of the public fields to keep the undefined bits out of the developer's way.
+ *
+ * Flag to disable the global search gesture. Don't use this
+ * unless you're a special part of the system UI (i.e., setup wizard, keyguard).
+ */
+ public static final int STATUS_BAR_DISABLE_SEARCH = 0x02000000;
+
+ /**
+ * @hide
*/
public static final int PUBLIC_STATUS_BAR_VISIBILITY_MASK = 0x0000FFFF;
@@ -8232,6 +8243,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
case MotionEvent.ACTION_CANCEL:
setPressed(false);
removeTapCallback();
+ removeLongPressCallback();
break;
case MotionEvent.ACTION_MOVE:
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index dabdf5a..c252c77 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -5990,11 +5990,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
*/
@Override
public void resolveLayoutDirection(int layoutDirection) {
- // No need to resolve if it is the same layout direction as before
- if (this.layoutDirection == layoutDirection) {
- return;
- }
-
setLayoutDirection(layoutDirection);
if (!isMarginRelative()) return;