Fix issue #3405731: Manage applications app names don't update with locale

Change-Id: Ia7dcf7973bde6785afb5978ee2a7858bc6740582
This commit is contained in:
Dianne Hackborn
2011-02-14 14:57:47 -08:00
parent cd44f206e0
commit 2372ba5b54
3 changed files with 77 additions and 7 deletions

View File

@@ -34,7 +34,6 @@ import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
import android.os.RemoteException;
import android.os.SystemClock;
import android.text.format.Formatter;
import android.util.Log;
import android.util.SparseArray;
@@ -54,9 +53,10 @@ public class RunningState {
static Object sGlobalLock = new Object();
static RunningState sInstance;
static final int MSG_UPDATE_CONTENTS = 1;
static final int MSG_REFRESH_UI = 2;
static final int MSG_UPDATE_TIME = 3;
static final int MSG_RESET_CONTENTS = 1;
static final int MSG_UPDATE_CONTENTS = 2;
static final int MSG_REFRESH_UI = 3;
static final int MSG_UPDATE_TIME = 4;
static final long TIME_UPDATE_DELAY = 1000;
static final long CONTENTS_UPDATE_DELAY = 2000;
@@ -69,6 +69,8 @@ public class RunningState {
OnRefreshUiListener mRefreshUiListener;
final InterestingConfigChanges mInterestingConfigChanges = new InterestingConfigChanges();
// Processes that are hosting a service we are interested in, organized
// by uid and name. Note that this mapping does not change even across
// service restarts, and during a restart there will still be a process
@@ -133,6 +135,9 @@ public class RunningState {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case MSG_RESET_CONTENTS:
reset();
break;
case MSG_UPDATE_CONTENTS:
synchronized (mLock) {
if (!mResumed) {
@@ -561,6 +566,12 @@ public class RunningState {
synchronized (mLock) {
mResumed = true;
mRefreshUiListener = listener;
if (mInterestingConfigChanges.applyNewConfig(mApplicationContext.getResources())) {
mHaveData = false;
mBackgroundHandler.removeMessages(MSG_RESET_CONTENTS);
mBackgroundHandler.removeMessages(MSG_UPDATE_CONTENTS);
mBackgroundHandler.sendEmptyMessage(MSG_RESET_CONTENTS);
}
if (!mBackgroundHandler.hasMessages(MSG_UPDATE_CONTENTS)) {
mBackgroundHandler.sendEmptyMessage(MSG_UPDATE_CONTENTS);
}
@@ -613,6 +624,15 @@ public class RunningState {
return false;
}
private void reset() {
mServiceProcessesByName.clear();
mServiceProcessesByPid.clear();
mInterestingProcesses.clear();
mRunningProcesses.clear();
mProcessItems.clear();
mAllProcessItems.clear();
}
private boolean update(Context context, ActivityManager am) {
final PackageManager pm = context.getPackageManager();
@@ -975,7 +995,7 @@ public class RunningState {
}
if (newBackgroundItems == null) {
// One or more at the bottom may no longer exit.
// One or more at the bottom may no longer exist.
if (mBackgroundItems.size() > numBackgroundProcesses) {
newBackgroundItems = new ArrayList<MergedItem>(numBackgroundProcesses);
for (int bgi=0; bgi<numBackgroundProcesses; bgi++) {