Merge "Rename file to satisfy strict Java requirement" into jb-mr1-dev
diff --git a/res/drawable/regulatory_info.png b/res/drawable/regulatory_info.png
new file mode 100644
index 0000000..65de26c
--- /dev/null
+++ b/res/drawable/regulatory_info.png
Binary files differ
diff --git a/res/layout/regulatory_info.xml b/res/layout/regulatory_info.xml
new file mode 100755
index 0000000..e4999a4
--- /dev/null
+++ b/res/layout/regulatory_info.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:src="@drawable/regulatory_info"/>
diff --git a/res/values/bools.xml b/res/values/bools.xml
index 23bdf0d..ba402e5 100644
--- a/res/values/bools.xml
+++ b/res/values/bools.xml
@@ -32,4 +32,7 @@
<!-- Whether User management screen is available -->
<bool name="enable_user_management">false</bool>
+
+ <!-- Whether to show a preference item for regulatory information in About phone -->
+ <bool name="config_show_regulatory_info">false</bool>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 233963c..e08cdeb 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -2237,6 +2237,8 @@
<string name="legal_information">Legal information</string>
<!-- About phone settings screen, setting option name to see a list of contributors -->
<string name="contributors_title">Contributors</string>
+ <!-- About phone settings screen, setting option name to show regulatory information [CHAR LIMIT=25] -->
+ <string name="regulatory_information">Regulatory information</string>
<!-- Note: this may be replaced by a more-specific title of the activity that will get launched --> <skip />
<!-- About phone settings screen, setting option name to see copyright-related info -->
<string name="copyright_title">Copyright</string>
diff --git a/res/xml/device_info_settings.xml b/res/xml/device_info_settings.xml
index 324deaa..4fabc9d 100644
--- a/res/xml/device_info_settings.xml
+++ b/res/xml/device_info_settings.xml
@@ -89,6 +89,10 @@
</PreferenceScreen>
-->
+ <Preference android:key="regulatory_info"
+ android:title="@string/regulatory_information"
+ android:fragment="com.android.settings.RegulatoryInfoFragment"/>
+
<!-- Device hardware model -->
<Preference android:key="device_model"
style="?android:preferenceInformationStyle"
@@ -106,7 +110,7 @@
style="?android:preferenceInformationStyle"
android:title="@string/fcc_equipment_id"
android:summary="@string/device_info_default"/>
-
+
<!-- Device Baseband version -->
<Preference android:key="baseband_version"
style="?android:preferenceInformationStyle"
diff --git a/src/com/android/settings/DataUsageSummary.java b/src/com/android/settings/DataUsageSummary.java
index 7c1832f6..8d51e10 100644
--- a/src/com/android/settings/DataUsageSummary.java
+++ b/src/com/android/settings/DataUsageSummary.java
@@ -461,7 +461,7 @@
mMenuAutoSync = menu.findItem(R.id.data_usage_menu_auto_sync);
mMenuAutoSync.setChecked(ContentResolver.getMasterSyncAutomatically());
- mMenuAutoSync.setVisible(isOwner && !appDetailMode);
+ mMenuAutoSync.setVisible(!appDetailMode);
final MenuItem split4g = menu.findItem(R.id.data_usage_menu_split_4g);
split4g.setVisible(hasReadyMobile4gRadio(context) && isOwner && !appDetailMode);
diff --git a/src/com/android/settings/DeviceInfoSettings.java b/src/com/android/settings/DeviceInfoSettings.java
index 8254233..258ea64 100644
--- a/src/com/android/settings/DeviceInfoSettings.java
+++ b/src/com/android/settings/DeviceInfoSettings.java
@@ -49,6 +49,7 @@
private static final String KEY_CONTAINER = "container";
private static final String KEY_TEAM = "team";
private static final String KEY_CONTRIBUTORS = "contributors";
+ private static final String KEY_REGULATORY_INFO = "regulatory_info";
private static final String KEY_TERMS = "terms";
private static final String KEY_LICENSE = "license";
private static final String KEY_COPYRIGHT = "copyright";
@@ -132,11 +133,12 @@
Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
// Read platform settings for additional system update setting
- boolean isUpdateSettingAvailable =
- getResources().getBoolean(R.bool.config_additional_system_update_setting_enable);
- if (isUpdateSettingAvailable == false) {
- getPreferenceScreen().removePreference(findPreference(KEY_UPDATE_SETTING));
- }
+ removePreferenceIfBoolFalse(KEY_UPDATE_SETTING,
+ R.bool.config_additional_system_update_setting_enable);
+
+ // Remove regulatory information if not enabled.
+ removePreferenceIfBoolFalse(KEY_REGULATORY_INFO,
+ R.bool.config_show_regulatory_info);
}
@Override
@@ -160,8 +162,7 @@
private void removePreferenceIfPropertyMissing(PreferenceGroup preferenceGroup,
String preference, String property ) {
- if (SystemProperties.get(property).equals(""))
- {
+ if (SystemProperties.get(property).equals("")) {
// Property is missing so remove preference from group
try {
preferenceGroup.removePreference(findPreference(preference));
@@ -172,6 +173,12 @@
}
}
+ private void removePreferenceIfBoolFalse(String preference, int resId) {
+ if (!getResources().getBoolean(resId)) {
+ getPreferenceScreen().removePreference(findPreference(preference));
+ }
+ }
+
private void setStringSummary(String preference, String value) {
try {
findPreference(preference).setSummary(value);
diff --git a/src/com/android/settings/RegulatoryInfoFragment.java b/src/com/android/settings/RegulatoryInfoFragment.java
new file mode 100644
index 0000000..7ee13bf
--- /dev/null
+++ b/src/com/android/settings/RegulatoryInfoFragment.java
@@ -0,0 +1,39 @@
+/*
+ * 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.settings;
+
+import android.app.DialogFragment;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.android.settings.R;
+
+/**
+ * {@link DialogFragment} that displays regulatory information.
+ * "About phone" will show a preference that displays this fragment when
+ * clicked if R.bool.config_show_regulatory_info is true.
+ */
+public class RegulatoryInfoFragment extends DialogFragment {
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.regulatory_info, container, false);
+ }
+}
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index 588075e..64e2ec3 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -459,8 +459,7 @@
Intent pickIntent = new Intent(AppWidgetManager.ACTION_APPWIDGET_PICK);
// Found in KeyguardHostView.java
final int KEYGUARD_HOST_ID = 0x4B455947;
- int appWidgetId = AppWidgetHost.allocateAppWidgetIdForHost(
- "com.android.internal.policy.impl.keyguard", KEYGUARD_HOST_ID);
+ int appWidgetId = AppWidgetHost.allocateAppWidgetIdForSystem(KEYGUARD_HOST_ID);
if (appWidgetId != -1) {
pickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
pickIntent.putExtra(AppWidgetManager.EXTRA_CUSTOM_SORT, false);
@@ -592,24 +591,23 @@
// Otherwise just add it
if (noWidget) {
// If we selected "none", delete the allocated id
- AppWidgetHost.deleteAppWidgetIdForHost(appWidgetId);
+ AppWidgetHost.deleteAppWidgetIdForSystem(appWidgetId);
data.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, -1);
- } else {
- onActivityResult(REQUEST_CREATE_APPWIDGET, Activity.RESULT_OK, data);
}
+ onActivityResult(REQUEST_CREATE_APPWIDGET, Activity.RESULT_OK, data);
}
} else if (
requestCode == REQUEST_CREATE_APPWIDGET && resultCode == Activity.RESULT_OK) {
// If a widget existed before, delete it
int oldAppWidgetId = getUserSelectedAppWidgetId();
if (oldAppWidgetId != -1) {
- AppWidgetHost.deleteAppWidgetIdForHost(oldAppWidgetId);
+ AppWidgetHost.deleteAppWidgetIdForSystem(oldAppWidgetId);
}
Settings.Secure.putString(getContentResolver(),
Settings.Secure.LOCK_SCREEN_USER_SELECTED_APPWIDGET_ID,
Integer.toString(appWidgetId));
} else {
- AppWidgetHost.deleteAppWidgetIdForHost(appWidgetId);
+ AppWidgetHost.deleteAppWidgetIdForSystem(appWidgetId);
}
}
createPreferenceHierarchy();
diff --git a/src/com/android/settings/applications/RunningServiceDetails.java b/src/com/android/settings/applications/RunningServiceDetails.java
index 52ed458..555f192 100644
--- a/src/com/android/settings/applications/RunningServiceDetails.java
+++ b/src/com/android/settings/applications/RunningServiceDetails.java
@@ -436,22 +436,24 @@
mNumServices = mNumProcesses = 0;
- if (mMergedItem.mUser != null) {
- ArrayList<RunningState.MergedItem> items;
- if (mShowBackground) {
- items = new ArrayList<RunningState.MergedItem>(mMergedItem.mChildren);
- Collections.sort(items, mState.mBackgroundComparator);
+ if (mMergedItem != null) {
+ if (mMergedItem.mUser != null) {
+ ArrayList<RunningState.MergedItem> items;
+ if (mShowBackground) {
+ items = new ArrayList<RunningState.MergedItem>(mMergedItem.mChildren);
+ Collections.sort(items, mState.mBackgroundComparator);
+ } else {
+ items = mMergedItem.mChildren;
+ }
+ for (int i=0; i<items.size(); i++) {
+ addDetailsViews(items.get(i), true, false);
+ }
+ for (int i=0; i<items.size(); i++) {
+ addDetailsViews(items.get(i), false, true);
+ }
} else {
- items = mMergedItem.mChildren;
+ addDetailsViews(mMergedItem, true, true);
}
- for (int i=0; i<items.size(); i++) {
- addDetailsViews(items.get(i), true, false);
- }
- for (int i=0; i<items.size(); i++) {
- addDetailsViews(items.get(i), false, true);
- }
- } else {
- addDetailsViews(mMergedItem, true, true);
}
}
diff --git a/src/com/android/settings/deviceinfo/FileItemInfoLayout.java b/src/com/android/settings/deviceinfo/FileItemInfoLayout.java
index 990f7f2..542d7c9 100644
--- a/src/com/android/settings/deviceinfo/FileItemInfoLayout.java
+++ b/src/com/android/settings/deviceinfo/FileItemInfoLayout.java
@@ -2,10 +2,9 @@
package com.android.settings.deviceinfo;
-import com.android.settings.R;
-
import android.content.Context;
-import android.os.Environment;
+import android.os.Environment.UserEnvironment;
+import android.os.UserHandle;
import android.util.AttributeSet;
import android.view.ViewDebug;
import android.widget.CheckBox;
@@ -13,6 +12,8 @@
import android.widget.RelativeLayout;
import android.widget.TextView;
+import com.android.settings.R;
+
/**
* Handles display of a single row entry on Settings --> Storage --> Misc Files screen
*/
@@ -20,8 +21,9 @@
private TextView mFileNameView;
private TextView mFileSizeView;
private CheckBox mCheckbox;
- private static final int mLengthExternalStorageDirPrefix =
- Environment.getExternalStorageDirectory().getAbsolutePath().length() + 1;
+
+ private static final int sLengthExternalStorageDirPrefix = new UserEnvironment(
+ UserHandle.myUserId()).getExternalStorageDirectory().getAbsolutePath().length() + 1;
public FileItemInfoLayout(Context context) {
this(context, null);
@@ -51,7 +53,7 @@
}
public void setFileName(String fileName) {
- mFileNameView.setText(fileName.substring(mLengthExternalStorageDirPrefix));
+ mFileNameView.setText(fileName.substring(sLengthExternalStorageDirPrefix));
}
public void setFileSize(String filesize) {