Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6704cb98 authored by Dan Sandler's avatar Dan Sandler Committed by Android (Google) Code Review
Browse files

Merge "Adjust iconography in notification guts." into lmp-dev

parents 29bd102b f4db75c2
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
<!--
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>
+11 −1
Original line number Diff line number Diff line
@@ -76,6 +76,16 @@
                    />
        </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"
@@ -83,7 +93,7 @@
                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>
+7 −3
Original line number Diff line number Diff line
@@ -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>
+42 −1
Original line number Diff line number Diff line
@@ -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);