Merge "Fixes password not being saved on orientation changed."
diff --git a/res/layout/bugreport_options_dialog.xml b/res/layout/bugreport_options_dialog.xml
new file mode 100644
index 0000000..ac98d18
--- /dev/null
+++ b/res/layout/bugreport_options_dialog.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 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.
+-->
+
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="horizontal" >
+
+ <CheckedTextView
+ android:id="@+id/bugreport_option_interactive_title"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:checked="true"
+ android:drawableStart="?android:attr/listChoiceIndicatorSingle"
+ android:ellipsize="marquee"
+ android:gravity="center_vertical"
+ android:paddingEnd="?android:attr/dialogPreferredPadding"
+ android:paddingStart="20dp"
+ android:text="@*android:string/bugreport_option_interactive_title"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textColor="?android:attr/textColorAlertDialogListItem" />
+
+ <TextView
+ android:id="@+id/bugreport_option_interactive_summary"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_below="@+id/bugreport_option_interactive_title"
+ android:maxLines="10"
+ android:paddingBottom="8dp"
+ android:paddingStart="52dp"
+ android:paddingEnd="?android:attr/dialogPreferredPadding"
+ android:text="@*android:string/bugreport_option_interactive_summary"
+ android:textAppearance="?android:attr/textAppearanceListItemSecondary"
+ android:textColor="?android:attr/textColorSecondary" />
+
+ <CheckedTextView
+ android:id="@+id/bugreport_option_full_title"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_below="@+id/bugreport_option_interactive_summary"
+ android:checked="false"
+ android:drawableStart="?android:attr/listChoiceIndicatorSingle"
+ android:ellipsize="marquee"
+ android:gravity="center_vertical"
+ android:paddingEnd="?android:attr/dialogPreferredPadding"
+ android:paddingStart="20dp"
+ android:text="@*android:string/bugreport_option_full_title"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textColor="?android:attr/textColorAlertDialogListItem" />
+
+ <TextView
+ android:id="@+id/bugreport_option_full_summary"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_below="@+id/bugreport_option_full_title"
+ android:maxLines="10"
+ android:paddingBottom="8dp"
+ android:paddingStart="52dp"
+ android:paddingEnd="?android:attr/dialogPreferredPadding"
+ android:text="@*android:string/bugreport_option_full_summary"
+ android:textAppearance="?android:attr/textAppearanceListItemSecondary"
+ android:textColor="?android:attr/textColorSecondary" />
+
+</RelativeLayout>
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 9ab180d..9d2f1f0 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5699,7 +5699,26 @@
<!-- Sound & notification > Notification section: Title for the option managing notifications per topic. [CHAR LIMIT=30] -->
<string name="topic_notifications_title">Topic notifications</string>
+ <!-- [CHAR LIMIT=100] Notification topic list header -->
+ <string name="notification_topic_categories">Categories</string>
+ <!-- [CHAR LIMIT=100] Notification importance slider title -->
+ <string name="notification_importance_title">Importance</string>
+
+ <!-- [CHAR LIMIT=100] Notification Importance slider: blocked importance level description -->
+ <string name="notification_importance_blocked">Blocked: Never show these notifications</string>
+
+ <!-- [CHAR LIMIT=100] Notification Importance slider: low importance level description -->
+ <string name="notification_importance_low">Low: Silently show at the bottom of the notification list</string>
+
+ <!-- [CHAR LIMIT=100] Notification Importance slider: normal importance level description -->
+ <string name="notification_importance_default">Normal: Silently show these notifications</string>
+
+ <!-- [CHAR LIMIT=100] Notification Importance slider: high importance level description -->
+ <string name="notification_importance_high">High: Show at the top of the notifications list and make sound</string>
+
+ <!-- [CHAR LIMIT=100] Notification Importance slider: max importance level description -->
+ <string name="notification_importance_max">Urgent: Peek onto the screen and make sound</string>
<!-- Sound & notification > Advanced section: Title for managing notification listeners option. [CHAR LIMIT=30] -->
<string name="manage_notification_access_title">Notification access</string>
diff --git a/res/xml/app_notification_settings.xml b/res/xml/app_notification_settings.xml
index 6e27a07..5f00caf 100644
--- a/res/xml/app_notification_settings.xml
+++ b/res/xml/app_notification_settings.xml
@@ -30,7 +30,12 @@
<Preference
android:key="app_settings"
android:title="@string/app_notification_preferences"
- android:order="5"
+ android:order="2"
android:persistent="false" />
+ <PreferenceCategory
+ android:key="categories"
+ android:title="@string/notification_topic_categories"
+ android:order="3" />
+
</PreferenceScreen>
diff --git a/res/xml/topic_notification_settings.xml b/res/xml/topic_notification_settings.xml
index 174c273..d5f28b3 100644
--- a/res/xml/topic_notification_settings.xml
+++ b/res/xml/topic_notification_settings.xml
@@ -21,7 +21,7 @@
<!-- Importance -->
<com.android.settings.notification.ImportanceSeekBarPreference
android:key="importance"
- android:title="@string/app_notification_importance_title"
+ android:title="@string/notification_importance_title"
android:order="1"
android:persistent="false" />
diff --git a/src/com/android/settings/BugreportPreference.java b/src/com/android/settings/BugreportPreference.java
index fc0466f..c3dd474 100644
--- a/src/com/android/settings/BugreportPreference.java
+++ b/src/com/android/settings/BugreportPreference.java
@@ -16,13 +16,31 @@
package com.android.settings;
+import android.app.ActivityManagerNative;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;
-import android.os.SystemProperties;
+import android.os.Handler;
+import android.os.RemoteException;
+import android.text.format.DateUtils;
import android.util.AttributeSet;
+import android.util.Log;
+import android.view.View;
+import android.widget.CheckedTextView;
+import android.widget.RadioButton;
+import android.widget.TextView;
+import android.widget.Toast;
public class BugreportPreference extends CustomDialogPreference {
+
+ private static final String TAG = "BugreportPreference";
+ private static final int BUGREPORT_DELAY_SECONDS = 3;
+
+ private CheckedTextView mInteractiveTitle;
+ private TextView mInteractiveSummary;
+ private CheckedTextView mFullTitle;
+ private TextView mFullSummary;
+
public BugreportPreference(Context context, AttributeSet attrs) {
super(context, attrs);
}
@@ -30,14 +48,67 @@
@Override
protected void onPrepareDialogBuilder(Builder builder, DialogInterface.OnClickListener listener) {
super.onPrepareDialogBuilder(builder, listener);
+
+ final View dialogView = View.inflate(getContext(), R.layout.bugreport_options_dialog, null);
+ mInteractiveTitle = (CheckedTextView) dialogView.findViewById(R.id.bugreport_option_interactive_title);
+ mInteractiveSummary = (TextView) dialogView.findViewById(R.id.bugreport_option_interactive_summary);
+ mFullTitle = (CheckedTextView) dialogView.findViewById(R.id.bugreport_option_full_title);
+ mFullSummary = (TextView) dialogView.findViewById(R.id.bugreport_option_full_summary);
+ final View.OnClickListener l = new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ if (v == mFullTitle || v == mFullSummary) {
+ mInteractiveTitle.setChecked(false);
+ mFullTitle.setChecked(true);
+ }
+ if (v == mInteractiveTitle || v == mInteractiveSummary) {
+ mInteractiveTitle.setChecked(true);
+ mFullTitle.setChecked(false);
+ }
+ }
+ };
+ mInteractiveTitle.setOnClickListener(l);
+ mFullTitle.setOnClickListener(l);
+ mInteractiveSummary.setOnClickListener(l);
+ mFullSummary.setOnClickListener(l);
+
builder.setPositiveButton(com.android.internal.R.string.report, listener);
- builder.setMessage(com.android.internal.R.string.bugreport_message);
+ builder.setView(dialogView);
}
@Override
protected void onClick(DialogInterface dialog, int which) {
if (which == DialogInterface.BUTTON_POSITIVE) {
- SystemProperties.set("ctl.start", "bugreportplus");
+
+ if (mFullTitle.isChecked()) {
+ Log.v(TAG, "Taking full bugreport right away");
+ takeBugreport(false);
+ } else {
+ Log.v(TAG, "Taking interactive bugreport in " + BUGREPORT_DELAY_SECONDS + "s");
+ // Add a little delay before executing, to give the user a chance to close
+ // the Settings activity before it takes a screenshot.
+ final Context context = getContext();
+ final String msg = context.getResources()
+ .getQuantityString(com.android.internal.R.plurals.bugreport_countdown,
+ BUGREPORT_DELAY_SECONDS, BUGREPORT_DELAY_SECONDS);
+ Log.v(TAG, msg);
+ Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
+ new Handler().postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ takeBugreport(true);
+ }
+ }, BUGREPORT_DELAY_SECONDS * DateUtils.SECOND_IN_MILLIS);
+ }
+ }
+ }
+
+ private void takeBugreport(boolean progress) {
+ try {
+ ActivityManagerNative.getDefault().requestBugReport(progress);
+ } catch (RemoteException e) {
+ Log.e(TAG, "error taking bugreport (progress=" + progress + ")", e);
}
}
}
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 70d50b0..9490fef 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -78,6 +78,7 @@
import android.widget.Switch;
import android.widget.TextView;
+import com.android.internal.app.LocalePicker;
import com.android.internal.logging.MetricsLogger;
import com.android.settings.applications.BackgroundCheckSummary;
import com.android.settings.fuelgauge.InactiveApps;
diff --git a/src/com/android/settings/FallbackHome.java b/src/com/android/settings/FallbackHome.java
index f92f2b2..d3e6482 100644
--- a/src/com/android/settings/FallbackHome.java
+++ b/src/com/android/settings/FallbackHome.java
@@ -21,25 +21,57 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.pm.ResolveInfo;
import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.os.UserManager;
import android.util.Log;
+import java.util.Objects;
+
public class FallbackHome extends Activity {
private static final String TAG = "FallbackHome";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
-
registerReceiver(mReceiver, new IntentFilter(Intent.ACTION_USER_UNLOCKED));
+ maybeFinish();
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ unregisterReceiver(mReceiver);
}
private BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
- Log.d(TAG, "User unlocked; leaving to find real home");
- unregisterReceiver(this);
- finish();
+ maybeFinish();
+ }
+ };
+
+ private void maybeFinish() {
+ if (getSystemService(UserManager.class).isUserUnlocked()) {
+ final Intent homeIntent = new Intent(Intent.ACTION_MAIN)
+ .addCategory(Intent.CATEGORY_HOME);
+ final ResolveInfo homeInfo = getPackageManager().resolveActivity(homeIntent, 0);
+ if (Objects.equals(getPackageName(), homeInfo.activityInfo.packageName)) {
+ Log.d(TAG, "User unlocked but no home; let's hope someone enables one soon?");
+ mHandler.sendEmptyMessageDelayed(0, 500);
+ } else {
+ Log.d(TAG, "User unlocked and real home found; let's go!");
+ finish();
+ }
+ }
+ }
+
+ private Handler mHandler = new Handler() {
+ @Override
+ public void handleMessage(Message msg) {
+ maybeFinish();
}
};
}
diff --git a/src/com/android/settings/LocalePicker.java b/src/com/android/settings/LocalePicker.java
index 8ea99a1..950b79c 100644
--- a/src/com/android/settings/LocalePicker.java
+++ b/src/com/android/settings/LocalePicker.java
@@ -28,8 +28,8 @@
import java.util.Locale;
-public class LocalePicker extends com.android.internal.app.LocalePicker
- implements com.android.internal.app.LocalePicker.LocaleSelectionListener,
+public class LocalePicker extends com.android.internal.app.LocalePickerWithRegion
+ implements com.android.internal.app.LocalePickerWithRegion.LocaleSelectionListener,
DialogCreatable {
private static final String TAG = "LocalePicker";
@@ -69,7 +69,7 @@
showDialog(DLG_SHOW_GLOBAL_WARNING);
} else {
getActivity().onBackPressed();
- LocalePicker.updateLocale(locale);
+ com.android.internal.app.LocalePicker.updateLocale(locale);
}
}
@@ -97,7 +97,7 @@
public void run() {
removeDialog(dialogId);
getActivity().onBackPressed();
- LocalePicker.updateLocale(mTargetLocale);
+ com.android.internal.app.LocalePicker.updateLocale(mTargetLocale);
}
}
);
diff --git a/src/com/android/settings/deviceinfo/SimStatus.java b/src/com/android/settings/deviceinfo/SimStatus.java
index 2138c24..a3dbcac 100644
--- a/src/com/android/settings/deviceinfo/SimStatus.java
+++ b/src/com/android/settings/deviceinfo/SimStatus.java
@@ -117,9 +117,7 @@
return;
}
CellBroadcastMessage cbMessage = (CellBroadcastMessage) extras.get("message");
- if (cbMessage != null
- && cbMessage.getServiceCategory() == 50
- && mSir.getSubscriptionId() == cbMessage.getSubId()) {
+ if (cbMessage != null && cbMessage.getServiceCategory() == 50) {
String latestAreaInfo = cbMessage.getMessageBody();
updateAreaInfo(latestAreaInfo);
}
diff --git a/src/com/android/settings/notification/AppNotificationSettings.java b/src/com/android/settings/notification/AppNotificationSettings.java
index deba7d4..2ee2b81 100644
--- a/src/com/android/settings/notification/AppNotificationSettings.java
+++ b/src/com/android/settings/notification/AppNotificationSettings.java
@@ -28,10 +28,12 @@
import android.os.Bundle;
import android.os.UserHandle;
import android.provider.Settings;
+import android.service.notification.NotificationListenerService;
import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.Preference;
import android.support.v7.preference.Preference.OnPreferenceChangeListener;
import android.support.v7.preference.Preference.OnPreferenceClickListener;
+import android.support.v7.preference.PreferenceCategory;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.Log;
@@ -55,6 +57,7 @@
private static final String KEY_BLOCK = "block";
private static final String KEY_APP_SETTINGS = "app_settings";
+ private static final String KEY_CATEGORIES = "categories";
private static final Intent APP_NOTIFICATION_PREFS_CATEGORY_INTENT
= new Intent(Intent.ACTION_MAIN)
@@ -64,6 +67,7 @@
private Context mContext;
private SwitchPreference mBlock;
+ private PreferenceCategory mCategories;
private AppRow mAppRow;
private boolean mCreated;
private boolean mIsSystemPackage;
@@ -136,6 +140,7 @@
// Add topics
List<Notification.Topic> topics = mBackend.getTopics(pkg, mUid);
+ mCategories = (PreferenceCategory) getPreferenceScreen().findPreference(KEY_CATEGORIES);
for (Notification.Topic topic : topics) {
Preference topicPreference = new Preference(mContext);
topicPreference.setKey(topic.getId());
@@ -151,8 +156,7 @@
TopicNotificationSettings.class.getName(),
topicArgs, null, R.string.topic_notifications_title, null, false);
topicPreference.setIntent(topicIntent);
- // Add preference to the settings menu.
- getPreferenceScreen().addPreference(topicPreference);
+ mCategories.addPreference(topicPreference);
}
mBlock.setChecked(mAppRow.banned);
@@ -198,6 +202,9 @@
private void updateDependents(boolean banned) {
setVisible(mBlock, !mIsSystemPackage);
+ if (mCategories != null) {
+ setVisible(mCategories, !banned);
+ }
}
private void setVisible(Preference p, boolean visible) {
diff --git a/src/com/android/settings/notification/ImportanceSeekBarPreference.java b/src/com/android/settings/notification/ImportanceSeekBarPreference.java
index ec77467..58892e3 100644
--- a/src/com/android/settings/notification/ImportanceSeekBarPreference.java
+++ b/src/com/android/settings/notification/ImportanceSeekBarPreference.java
@@ -90,20 +90,15 @@
private String getProgressSummary(int progress) {
switch (progress) {
case NotificationListenerService.Ranking.IMPORTANCE_NONE:
- return getContext().getString(
- com.android.internal.R.string.notification_importance_blocked);
+ return getContext().getString(R.string.notification_importance_blocked);
case NotificationListenerService.Ranking.IMPORTANCE_LOW:
- return getContext().getString(
- com.android.internal.R.string.notification_importance_low);
+ return getContext().getString(R.string.notification_importance_low);
case NotificationListenerService.Ranking.IMPORTANCE_DEFAULT:
- return getContext().getString(
- com.android.internal.R.string.notification_importance_default);
+ return getContext().getString(R.string.notification_importance_default);
case NotificationListenerService.Ranking.IMPORTANCE_HIGH:
- return getContext().getString(
- com.android.internal.R.string.notification_importance_high);
+ return getContext().getString(R.string.notification_importance_high);
case NotificationListenerService.Ranking.IMPORTANCE_MAX:
- return getContext().getString(
- com.android.internal.R.string.notification_importance_max);
+ return getContext().getString(R.string.notification_importance_max);
default:
return "";
}
diff --git a/src/com/android/settings/notification/NotificationBackend.java b/src/com/android/settings/notification/NotificationBackend.java
index 4c1f6ea..15f82fe 100644
--- a/src/com/android/settings/notification/NotificationBackend.java
+++ b/src/com/android/settings/notification/NotificationBackend.java
@@ -144,7 +144,7 @@
return sINM.getTopicImportance(pkg, uid, topic);
} catch (Exception e) {
Log.w(TAG, "Error calling NoMan", e);
- return NotificationListenerService.Ranking.IMPORTANCE_DEFAULT;
+ return NotificationListenerService.Ranking.IMPORTANCE_UNSPECIFIED;
}
}
diff --git a/src/com/android/settings/notification/TopicNotificationSettings.java b/src/com/android/settings/notification/TopicNotificationSettings.java
index e847e34..e8586c2 100644
--- a/src/com/android/settings/notification/TopicNotificationSettings.java
+++ b/src/com/android/settings/notification/TopicNotificationSettings.java
@@ -21,11 +21,11 @@
import com.android.settings.AppHeader;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
-import com.android.settings.Utils;
import com.android.settings.applications.AppInfoBase;
import com.android.settings.notification.NotificationBackend.TopicRow;
import android.app.Notification;
+import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
@@ -59,8 +59,8 @@
private SwitchPreference mSensitive;
private TopicRow mTopicRow;
private boolean mCreated;
- private boolean mIsSystemPackage;
private int mUid;
+ private boolean mDndVisualEffectsSuppressed;
@Override
public void onActivityCreated(Bundle savedInstanceState) {
@@ -94,6 +94,10 @@
return;
}
+ NotificationManager.Policy policy =
+ NotificationManager.from(mContext).getNotificationPolicy();
+ mDndVisualEffectsSuppressed = policy == null ? false : policy.suppressedVisualEffects != 0;
+
final Notification.Topic topic = args != null && args.containsKey(ARG_TOPIC)
? (Notification.Topic) args.getParcelable(ARG_TOPIC) : null;
@@ -120,7 +124,6 @@
}
final PackageManager pm = getPackageManager();
- mIsSystemPackage = Utils.isSystemPackage(pm, info);
addPreferencesFromResource(R.xml.topic_notification_settings);
mImportance = (ImportanceSeekBarPreference) findPreference(KEY_IMPORTANCE);
@@ -140,6 +143,7 @@
@Override
public void onImportanceChanged(int progress) {
mBackend.setImportance(mTopicRow.pkg, mTopicRow.uid, mTopicRow.topic, progress);
+ updateDependents(progress);
}
});
mPriority.setChecked(mTopicRow.priority);
@@ -160,7 +164,7 @@
return mBackend.setSensitive(info.packageName, mUid, topic, sensitive);
}
});
- updateDependents(mTopicRow.banned);
+ updateDependents(mTopicRow.importance);
}
@@ -173,16 +177,17 @@
}
}
- private void updateDependents(boolean banned) {
+ private void updateDependents(int importance) {
final boolean lockscreenSecure = new LockPatternUtils(getActivity()).isSecure(
UserHandle.myUserId());
final boolean lockscreenNotificationsEnabled = getLockscreenNotificationsEnabled();
final boolean allowPrivate = getLockscreenAllowPrivateNotifications();
- setVisible(mPriority, mIsSystemPackage || !banned);
- setVisible(mSensitive, mIsSystemPackage || !banned && lockscreenSecure
- && lockscreenNotificationsEnabled && allowPrivate);
- setVisible(mImportance, !banned);
+
+ setVisible(mPriority, importance > NotificationListenerService.Ranking.IMPORTANCE_DEFAULT
+ && !mDndVisualEffectsSuppressed);
+ setVisible(mSensitive, (importance > NotificationListenerService.Ranking.IMPORTANCE_LOW)
+ && lockscreenSecure && lockscreenNotificationsEnabled && allowPrivate);
}
private void setVisible(Preference p, boolean visible) {
diff --git a/src/com/android/settings/print/PrintJobSettingsFragment.java b/src/com/android/settings/print/PrintJobSettingsFragment.java
index cdc676d..80bf166 100644
--- a/src/com/android/settings/print/PrintJobSettingsFragment.java
+++ b/src/com/android/settings/print/PrintJobSettingsFragment.java
@@ -17,7 +17,6 @@
package com.android.settings.print;
import android.content.Context;
-import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.print.PrintJob;
import android.print.PrintJobId;
@@ -50,8 +49,6 @@
private static final String PRINT_JOB_PREFERENCE = "print_job_preference";
private static final String PRINT_JOB_MESSAGE_PREFERENCE = "print_job_message_preference";
- private Drawable mListDivider;
-
private final PrintJobStateChangeListener mPrintJobStateChangeListener =
new PrintJobStateChangeListener() {
@Override