Merge "Measure external storage application usage" into honeycomb
diff --git a/res/layout/settings_actionbar.xml b/res/layout/settings_actionbar.xml
deleted file mode 100644
index 711a0a1..0000000
--- a/res/layout/settings_actionbar.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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.
--->
-
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="horizontal"
- android:padding="4dip"
- android:gravity="center_vertical"
- android:layout_width="wrap_content"
- android:layout_height="match_parent">
-
- <!-- ImageView
- android:src="@mipmap/ic_launcher_settings"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:layout_marginLeft="4dip"
- android:layout_marginRight="4dip"
- /-->
-
- <view class="com.android.settings.Settings$BreadCrumbs"
- android:id="@+id/bread_crumbs"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:orientation="horizontal">
-
- <TextView android:id="@+id/level_up_title"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:gravity="center_vertical"
- style="?android:attr/textAppearanceMediumInverse"
- />
-
- <ImageView
- android:id="@+id/level_divider"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_marginTop="4dip"
- android:layout_marginBottom="4dip"
- android:layout_marginLeft="12dip"
- android:layout_marginRight="12dip"
- android:src="@drawable/nav_divider"/>
-
- <TextView android:id="@+id/level_current_title"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:gravity="center_vertical"
- style="?android:attr/textAppearanceMediumInverse"
- />
- </view>
-</LinearLayout>
diff --git a/res/layout/settings_top_level.xml b/res/layout/settings_top_level.xml
deleted file mode 100644
index b029915..0000000
--- a/res/layout/settings_top_level.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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.
--->
-
-<!-- Top-level Settings layout with fragments. -->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <FrameLayout android:id="@+id/prefs"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- />
-
- <!-- button_bar -->
- <RelativeLayout android:id="@+id/button_bar"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:layout_weight="0"
- android:background="@android:drawable/bottom_bar"
- android:visibility="gone">
-
- <Button android:id="@+id/back_button"
- android:layout_width="150dip"
- android:layout_height="wrap_content"
- android:layout_margin="5dip"
- android:layout_alignParentLeft="true"
- android:drawablePadding="3dip"
- />
- <LinearLayout
- android:orientation="horizontal"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentRight="true">
-
- <Button android:id="@+id/skip_button"
- android:layout_width="150dip"
- android:layout_height="wrap_content"
- android:layout_margin="5dip"
- android:text="@string/skip_button_label"
- android:visibility="gone"
- />
-
- <Button android:id="@+id/next_button"
- android:layout_width="150dip"
- android:layout_height="wrap_content"
- android:layout_margin="5dip"
- android:drawableRight="@drawable/ic_btn_next"
- android:drawablePadding="3dip"
- android:text="@string/next_button_label"
- />
- </LinearLayout>
- </RelativeLayout>
-</LinearLayout>
diff --git a/src/com/android/settings/deviceinfo/MemoryMeasurement.java b/src/com/android/settings/deviceinfo/MemoryMeasurement.java
index ead9dd6..19bd784 100644
--- a/src/com/android/settings/deviceinfo/MemoryMeasurement.java
+++ b/src/com/android/settings/deviceinfo/MemoryMeasurement.java
@@ -180,8 +180,6 @@
public static final int MSG_INVALIDATE = 6;
- private List<String> mPendingApps = new ArrayList<String>();
-
private Object mLock = new Object();
private IMediaContainerService mDefaultContainer;
@@ -190,7 +188,7 @@
private volatile boolean mMeasured = false;
- private long mAppsSize = 0;
+ private StatsObserver mStatsObserver;
private final WeakReference<Context> mContext;
@@ -287,39 +285,49 @@
sendEmptyMessage(MSG_DISCONNECT);
}
- public void queuePackageMeasurementLocked(String packageName) {
- mPendingApps.add(packageName);
- }
-
/**
* Request measurement of each package.
*
* @param pm PackageManager instance to query
*/
public void requestQueuedMeasurementsLocked(PackageManager pm) {
- final int N = mPendingApps.size();
+ final List<String> appsList = mStatsObserver.getAppsList();
+ final int N = appsList.size();
for (int i = 0; i < N; i++) {
- pm.getPackageSizeInfo(mPendingApps.get(i), mStatsObserver);
+ pm.getPackageSizeInfo(appsList.get(i), mStatsObserver);
}
}
- final IPackageStatsObserver.Stub mStatsObserver = new IPackageStatsObserver.Stub() {
+ private class StatsObserver extends IPackageStatsObserver.Stub {
+ private long mAppsSizeForThisStatsObserver = 0;
+ private final List<String> mAppsList = new ArrayList<String>();
public void onGetStatsCompleted(PackageStats stats, boolean succeeded) {
+ if (!mStatsObserver.equals(this)) {
+ // this callback's class object is no longer in use. ignore this callback.
+ return;
+ }
if (succeeded) {
- mAppsSize += stats.codeSize + stats.dataSize;
+ mAppsSizeForThisStatsObserver += stats.codeSize + stats.dataSize;
}
- synchronized (mPendingApps) {
- mPendingApps.remove(stats.packageName);
+ synchronized (mAppsList) {
+ mAppsList.remove(stats.packageName);
- if (mPendingApps.size() == 0) {
- mInternalAppsSize = mAppsSize;
+ if (mAppsList.size() == 0) {
+ mInternalAppsSize = mAppsSizeForThisStatsObserver;
onInternalMeasurementComplete();
}
}
}
- };
+
+ public void queuePackageMeasurementLocked(String packageName) {
+ mAppsList.add(packageName);
+ }
+ public List<String> getAppsList() {
+ return mAppsList;
+ }
+ }
private void onInternalMeasurementComplete() {
sendEmptyMessage(MSG_COMPLETED);
@@ -368,10 +376,12 @@
.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES
| PackageManager.GET_DISABLED_COMPONENTS);
if (apps != null) {
- synchronized (mPendingApps) {
+ // initiate measurement of all package sizes. need new StatsObserver object.
+ mStatsObserver = new StatsObserver();
+ synchronized (mStatsObserver.mAppsList) {
for (int i = 0; i < apps.size(); i++) {
final ApplicationInfo info = apps.get(i);
- queuePackageMeasurementLocked(info.packageName);
+ mStatsObserver.queuePackageMeasurementLocked(info.packageName);
}
requestQueuedMeasurementsLocked(pm);
diff --git a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
index 117bec5..a4808b0 100644
--- a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
+++ b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
@@ -21,29 +21,15 @@
import com.android.settings.Utils;
import com.android.settings.VoiceInputOutputSettings;
-import android.app.AlertDialog;
import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.os.Bundle;
-import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
-import android.preference.PreferenceGroup;
import android.preference.PreferenceScreen;
import android.provider.Settings;
-import android.text.TextUtils;
-import android.util.Log;
-import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodManager;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
implements Preference.OnPreferenceChangeListener{
diff --git a/src/com/android/settings/inputmethod/InputMethodAndSubtypeUtil.java b/src/com/android/settings/inputmethod/InputMethodAndSubtypeUtil.java
index 6981927..03c5ea1 100644
--- a/src/com/android/settings/inputmethod/InputMethodAndSubtypeUtil.java
+++ b/src/com/android/settings/inputmethod/InputMethodAndSubtypeUtil.java
@@ -204,6 +204,7 @@
if (DEBUG) {
Log.d(TAG, "Current IME was uninstalled or disabled.");
}
+ currentInputMethodId = null;
}
}
// If it's a disabled system ime, add it to the disabled list so that it