diff options
| -rw-r--r-- | packages/SystemUI/res/drawable/ic_info.xml | 24 | ||||
| -rw-r--r-- | packages/SystemUI/res/layout/notification_guts.xml | 12 | ||||
| -rw-r--r-- | packages/SystemUI/res/values/strings.xml | 10 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java | 43 |
4 files changed, 84 insertions, 5 deletions
diff --git a/packages/SystemUI/res/drawable/ic_info.xml b/packages/SystemUI/res/drawable/ic_info.xml new file mode 100644 index 000000000000..65e7bf5fa41d --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_info.xml @@ -0,0 +1,24 @@ +<!-- +Copyright (C) 2014 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. +--> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24.0dp" + android:height="24.0dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + <path + android:pathData="M12.000000,2.000000C6.500000,2.000000 2.000000,6.500000 2.000000,12.000000s4.500000,10.000000 10.000000,10.000000c5.500000,0.000000 10.000000,-4.500000 10.000000,-10.000000S17.500000,2.000000 12.000000,2.000000zM13.000000,17.000000l-2.000000,0.000000l0.000000,-6.000000l2.000000,0.000000L13.000000,17.000000zM13.000000,9.000000l-2.000000,0.000000L11.000000,7.000000l2.000000,0.000000L13.000000,9.000000z" + android:fillColor="#FFFFFF"/> +</vector> diff --git a/packages/SystemUI/res/layout/notification_guts.xml b/packages/SystemUI/res/layout/notification_guts.xml index ac8af1b7b44d..d52c27465dbb 100644 --- a/packages/SystemUI/res/layout/notification_guts.xml +++ b/packages/SystemUI/res/layout/notification_guts.xml @@ -77,13 +77,23 @@ </LinearLayout> <ImageButton style="@android:style/Widget.Material.Light.Button.Borderless.Small" + android:id="@+id/notification_inspect_app_provided_settings" + android:layout_width="52dp" + android:layout_height="match_parent" + android:layout_weight="0" + android:gravity="center" + android:src="@drawable/ic_settings" + android:visibility="gone" + /> + + <ImageButton style="@android:style/Widget.Material.Light.Button.Borderless.Small" android:id="@+id/notification_inspect_item" android:layout_width="52dp" android:layout_height="match_parent" android:layout_weight="0" android:gravity="center" android:contentDescription="@string/status_bar_notification_inspect_item_title" - android:src="@drawable/ic_settings" + android:src="@drawable/ic_info" /> </LinearLayout> </com.android.systemui.statusbar.NotificationGuts> diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index b488c562a42b..c7a91afc8da3 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -522,9 +522,13 @@ <!-- Content description of the clear button in the notification panel for accessibility (not shown on the screen). [CHAR LIMIT=NONE] --> <string name="accessibility_clear_all">Clear all notifications.</string> - <!-- Title shown in notification popup for inspecting the responsible - application [CHAR LIMIT=30] --> - <string name="status_bar_notification_inspect_item_title">Settings</string> + <!-- Content description of button in notification inspector for system settings relating to + notifications from this application [CHAR LIMIT=NONE] --> + <string name="status_bar_notification_inspect_item_title">Notification settings</string> + + <!-- Content description of button in notification inspetor for application-provided settings + for its own notifications [CHAR LIMIT=NONE] --> + <string name="status_bar_notification_app_settings_title"><xliff:g id="app_name" example="Calendar">%s</xliff:g> settings</string> <!-- Description of the button in the phone-style notification panel that controls auto-rotation, when auto-rotation is on. [CHAR LIMIT=NONE] --> <string name="accessibility_rotation_lock_off">Screen will rotate automatically.</string> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index ce29407b0d1f..71a07d9c0929 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -34,6 +34,7 @@ import android.content.IntentFilter; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; +import android.content.pm.ResolveInfo; import android.content.pm.UserInfo; import android.content.res.Configuration; import android.content.res.Resources; @@ -96,6 +97,7 @@ import com.android.systemui.statusbar.policy.HeadsUpNotificationView; import com.android.systemui.statusbar.stack.NotificationStackScrollLayout; import java.util.ArrayList; +import java.util.List; import java.util.Locale; import static com.android.keyguard.KeyguardHostView.OnDismissAction; @@ -717,11 +719,23 @@ public abstract class BaseStatusBar extends SystemUI implements entry.expandedBig.findViewById(com.android.internal.R.id.media_actions) != null; } + // The gear button in the guts that links to the app's own notification settings + private void startAppOwnNotificationSettingsActivity(Intent intent, + final int notificationId, final String notificationTag, final int appUid) { + intent.putExtra("notification_id", notificationId); + intent.putExtra("notification_tag", notificationTag); + startNotificationGutsIntent(intent, appUid); + } + + // The (i) button in the guts that links to the system notification settings for that app private void startAppNotificationSettingsActivity(String packageName, final int appUid) { final Intent intent = new Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS); intent.putExtra(Settings.EXTRA_APP_PACKAGE, packageName); intent.putExtra(Settings.EXTRA_APP_UID, appUid); + startNotificationGutsIntent(intent, appUid); + } + private void startNotificationGutsIntent(final Intent intent, final int appUid) { final boolean keyguardShowing = mStatusBarKeyguardViewManager.isShowing(); dismissKeyguardThenExecute(new OnDismissAction() { @Override @@ -1128,7 +1142,7 @@ public abstract class BaseStatusBar extends SystemUI implements entry.notification.getUser().getIdentifier()); int maxHeight = mRowMaxHeight; - StatusBarNotification sbn = entry.notification; + final StatusBarNotification sbn = entry.notification; RemoteViews contentView = sbn.getNotification().contentView; RemoteViews bigContentView = sbn.getNotification().bigContentView; @@ -1197,6 +1211,8 @@ public abstract class BaseStatusBar extends SystemUI implements ((DateTimeView) row.findViewById(R.id.timestamp)).setTime(entry.notification.getPostTime()); ((TextView) row.findViewById(R.id.pkgname)).setText(appname); final View settingsButton = guts.findViewById(R.id.notification_inspect_item); + final View appSettingsButton + = guts.findViewById(R.id.notification_inspect_app_provided_settings); if (appUid >= 0) { final int appUidF = appUid; settingsButton.setOnClickListener(new View.OnClickListener() { @@ -1204,8 +1220,33 @@ public abstract class BaseStatusBar extends SystemUI implements startAppNotificationSettingsActivity(pkg, appUidF); } }); + + final Intent appSettingsQueryIntent + = new Intent(Intent.ACTION_MAIN) + .addCategory(Notification.INTENT_CATEGORY_NOTIFICATION_PREFERENCES) + .setPackage(pkg); + List<ResolveInfo> infos = pmUser.queryIntentActivities(appSettingsQueryIntent, 0); + if (infos.size() > 0) { + appSettingsButton.setVisibility(View.VISIBLE); + appSettingsButton.setContentDescription( + mContext.getResources().getString( + R.string.status_bar_notification_app_settings_title, + appname + )); + final Intent appSettingsLaunchIntent = new Intent(appSettingsQueryIntent) + .setClassName(pkg, infos.get(0).activityInfo.name); + appSettingsButton.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + startAppOwnNotificationSettingsActivity(appSettingsLaunchIntent, + sbn.getId(), + sbn.getTag(), + appUidF); + } + }); + } } else { settingsButton.setVisibility(View.GONE); + appSettingsButton.setVisibility(View.GONE); } workAroundBadLayerDrawableOpacity(row); |