summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/LauncherActivity.java11
-rw-r--r--core/java/android/content/SyncManager.java17
-rw-r--r--core/java/android/provider/Settings.java7
-rw-r--r--core/java/android/view/View.java8
-rw-r--r--core/java/android/view/textservice/TextServicesManager.java6
-rw-r--r--core/java/android/widget/TextView.java37
6 files changed, 76 insertions, 10 deletions
diff --git a/core/java/android/app/LauncherActivity.java b/core/java/android/app/LauncherActivity.java
index 8eb9ba4..96c7246 100644
--- a/core/java/android/app/LauncherActivity.java
+++ b/core/java/android/app/LauncherActivity.java
@@ -439,14 +439,21 @@ public abstract class LauncherActivity extends ListActivity {
protected List<ResolveInfo> onQueryPackageManager(Intent queryIntent) {
return mPackageManager.queryIntentActivities(queryIntent, /* no flags */ 0);
}
-
+
+ /**
+ * @hide
+ */
+ protected void onSortResultList(List<ResolveInfo> results) {
+ Collections.sort(results, new ResolveInfo.DisplayNameComparator(mPackageManager));
+ }
+
/**
* Perform the query to determine which results to show and return a list of them.
*/
public List<ListItem> makeListItems() {
// Load all matching activities and sort correctly
List<ResolveInfo> list = onQueryPackageManager(mIntent);
- Collections.sort(list, new ResolveInfo.DisplayNameComparator(mPackageManager));
+ onSortResultList(list);
ArrayList<ListItem> result = new ArrayList<ListItem>(list.size());
int listSize = list.size();
diff --git a/core/java/android/content/SyncManager.java b/core/java/android/content/SyncManager.java
index e0e2995..1e4ad76 100644
--- a/core/java/android/content/SyncManager.java
+++ b/core/java/android/content/SyncManager.java
@@ -243,6 +243,10 @@ public class SyncManager {
public void updateRunningAccounts() {
mRunningAccounts = AccountManagerService.getSingleton().getRunningAccounts();
+ if (mBootCompleted) {
+ doDatabaseCleanup();
+ }
+
for (ActiveSyncContext currentSyncContext : mActiveSyncContexts) {
if (!containsAccountAndUser(mRunningAccounts,
currentSyncContext.mSyncOperation.account,
@@ -258,6 +262,13 @@ public class SyncManager {
sendCheckAlarmsMessage();
}
+ private void doDatabaseCleanup() {
+ for (UserInfo user : mUserManager.getUsers()) {
+ Account[] accountsForUser = AccountManagerService.getSingleton().getAccounts(user.id);
+ mSyncStorageEngine.doDatabaseCleanup(accountsForUser, user.id);
+ }
+ }
+
private BroadcastReceiver mConnectivityIntentReceiver =
new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
@@ -891,12 +902,10 @@ public class SyncManager {
updateRunningAccounts();
- final Account[] accounts = AccountManagerService.getSingleton().getAccounts(userId);
- mSyncStorageEngine.doDatabaseCleanup(accounts, userId);
-
mSyncQueue.addPendingOperations(userId);
// Schedule sync for any accounts under started user
+ final Account[] accounts = AccountManagerService.getSingleton().getAccounts(userId);
for (Account account : accounts) {
scheduleSync(account, userId, null, null, 0 /* no delay */,
true /* onlyThoseWithUnknownSyncableState */);
@@ -1619,6 +1628,8 @@ public class SyncManager {
public void onBootCompleted() {
mBootCompleted = true;
+ doDatabaseCleanup();
+
if (mReadyToRunLatch != null) {
mReadyToRunLatch.countDown();
}
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 00ea873..8897039 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -386,10 +386,9 @@ public final class Settings {
/**
* Activity Action: Show settings to allow configuration of application
- * development-related settings.
- * <p>
- * In some cases, a matching Activity may not exist, so ensure you safeguard
- * against this.
+ * development-related settings. As of
+ * {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} this action is
+ * a required part of the platform.
* <p>
* Input: Nothing.
* <p>
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 22243b1..608bdd7 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -5214,11 +5214,19 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
*/
@RemotableViewMethod
public void setContentDescription(CharSequence contentDescription) {
+ if (mContentDescription == null) {
+ if (contentDescription == null) {
+ return;
+ }
+ } else if (mContentDescription.equals(contentDescription)) {
+ return;
+ }
mContentDescription = contentDescription;
final boolean nonEmptyDesc = contentDescription != null && contentDescription.length() > 0;
if (nonEmptyDesc && getImportantForAccessibility() == IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
}
+ notifyAccessibilityStateChanged();
}
/**
diff --git a/core/java/android/view/textservice/TextServicesManager.java b/core/java/android/view/textservice/TextServicesManager.java
index 81b36db..e0e19b9 100644
--- a/core/java/android/view/textservice/TextServicesManager.java
+++ b/core/java/android/view/textservice/TextServicesManager.java
@@ -217,6 +217,12 @@ public final class TextServicesManager {
public SpellCheckerSubtype getCurrentSpellCheckerSubtype(
boolean allowImplicitlySelectedSubtype) {
try {
+ if (sService == null) {
+ // TODO: This is a workaround. Needs to investigate why sService could be null
+ // here.
+ Log.e(TAG, "sService is null.");
+ return null;
+ }
// Passing null as a locale until we support multiple enabled spell checker subtypes.
return sService.getCurrentSpellCheckerSubtype(null, allowImplicitlySelectedSubtype);
} catch (RemoteException e) {
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 410a0ca..958b669 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -33,6 +33,7 @@ import android.graphics.RectF;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.inputmethodservice.ExtractEditText;
+import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
@@ -132,6 +133,7 @@ import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Locale;
+import java.util.concurrent.locks.ReentrantLock;
/**
* Displays text to the user and optionally allows them to edit it. A TextView
@@ -378,6 +380,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
private InputFilter[] mFilters = NO_FILTERS;
+ private volatile Locale mCurrentTextServicesLocaleCache;
+ private final ReentrantLock mCurrentTextServicesLocaleLock = new ReentrantLock();
+
// It is possible to have a selection even when mEditor is null (programmatically set, like when
// a link is pressed). These highlight-related fields do not go in mEditor.
int mHighlightColor = 0x6633B5E5;
@@ -7675,13 +7680,43 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
/**
* This is a temporary method. Future versions may support multi-locale text.
+ * Caveat: This method may not return the latest text services locale, but this should be
+ * acceptable and it's more important to make this method asynchronous.
*
* @return The locale that should be used for a word iterator and a spell checker
* in this TextView, based on the current spell checker settings,
* the current IME's locale, or the system default locale.
* @hide
*/
+ // TODO: Support multi-locale
+ // TODO: Update the text services locale immediately after the keyboard locale is switched
+ // by catching intent of keyboard switch event
public Locale getTextServicesLocale() {
+ if (mCurrentTextServicesLocaleCache == null) {
+ // If there is no cached text services locale, just return the default locale.
+ mCurrentTextServicesLocaleCache = Locale.getDefault();
+ }
+ // Start fetching the text services locale asynchronously.
+ updateTextServicesLocaleAsync();
+ return mCurrentTextServicesLocaleCache;
+ }
+
+ private void updateTextServicesLocaleAsync() {
+ AsyncTask.execute(new Runnable() {
+ @Override
+ public void run() {
+ if (mCurrentTextServicesLocaleLock.tryLock()) {
+ try {
+ updateTextServicesLocaleLocked();
+ } finally {
+ mCurrentTextServicesLocaleLock.unlock();
+ }
+ }
+ }
+ });
+ }
+
+ private void updateTextServicesLocaleLocked() {
Locale locale = Locale.getDefault();
final TextServicesManager textServicesManager = (TextServicesManager)
mContext.getSystemService(Context.TEXT_SERVICES_MANAGER_SERVICE);
@@ -7689,7 +7724,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
if (subtype != null) {
locale = SpellCheckerSubtype.constructLocaleFromString(subtype.getLocale());
}
- return locale;
+ mCurrentTextServicesLocaleCache = locale;
}
void onLocaleChanged() {