Loading packages/SystemUI/res/layout/status_bar_notification_row.xml +4 −3 Original line number Diff line number Diff line Loading @@ -52,9 +52,10 @@ android:paddingStart="8dp" /> <include layout="@layout/notification_guts" android:id="@+id/notification_guts" <ViewStub android:layout="@layout/notification_guts" android:id="@+id/notification_guts_stub" android:inflatedId="@+id/notification_guts" android:layout_width="match_parent" android:layout_height="match_parent" /> Loading packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +81 −62 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ import android.view.View; import android.view.ViewAnimationUtils; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; import android.view.ViewStub; import android.view.WindowManager; import android.view.WindowManagerGlobal; import android.view.accessibility.AccessibilityManager; Loading Loading @@ -764,17 +765,95 @@ public abstract class BaseStatusBar extends SystemUI implements }, false /* afterKeyguardGone */); } private void inflateGuts(ExpandableNotificationRow row) { ViewStub stub = (ViewStub) row.findViewById(R.id.notification_guts_stub); if (stub != null) { stub.inflate(); } final StatusBarNotification sbn = row.getStatusBarNotification(); PackageManager pmUser = getPackageManagerForUser( sbn.getUser().getIdentifier()); row.setTag(sbn.getPackageName()); final View guts = row.findViewById(R.id.notification_guts); final String pkg = sbn.getPackageName(); String appname = pkg; Drawable pkgicon = null; int appUid = -1; try { final ApplicationInfo info = pmUser.getApplicationInfo(pkg, PackageManager.GET_UNINSTALLED_PACKAGES | PackageManager.GET_DISABLED_COMPONENTS); if (info != null) { appname = String.valueOf(pmUser.getApplicationLabel(info)); pkgicon = pmUser.getApplicationIcon(info); appUid = info.uid; } } catch (NameNotFoundException e) { // app is gone, just show package name and generic icon pkgicon = pmUser.getDefaultActivityIcon(); } ((ImageView) row.findViewById(android.R.id.icon)).setImageDrawable(pkgicon); ((DateTimeView) row.findViewById(R.id.timestamp)).setTime(sbn.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() { public void onClick(View v) { 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 { appSettingsButton.setVisibility(View.GONE); } } else { settingsButton.setVisibility(View.GONE); appSettingsButton.setVisibility(View.GONE); } } protected SwipeHelper.LongPressListener getNotificationLongClicker() { return new SwipeHelper.LongPressListener() { @Override public boolean onLongPress(View v, int x, int y) { dismissPopups(); if (!(v instanceof ExpandableNotificationRow)) { return false; } if (v.getWindowToken() == null) { Log.e(TAG, "Trying to show notification guts, but not attached to window"); return false; } inflateGuts((ExpandableNotificationRow) v); // Assume we are a status_bar_notification_row final NotificationGuts guts = (NotificationGuts) v.findViewById( R.id.notification_guts); Loading Loading @@ -1190,67 +1269,6 @@ public abstract class BaseStatusBar extends SystemUI implements row.setExpansionLogger(this, entry.notification.getKey()); } // the notification inspector (see SwipeHelper.setLongPressListener) row.setTag(sbn.getPackageName()); final View guts = row.findViewById(R.id.notification_guts); final String pkg = entry.notification.getPackageName(); String appname = pkg; Drawable pkgicon = null; int appUid = -1; try { final ApplicationInfo info = pmUser.getApplicationInfo(pkg, PackageManager.GET_UNINSTALLED_PACKAGES | PackageManager.GET_DISABLED_COMPONENTS); if (info != null) { appname = String.valueOf(pmUser.getApplicationLabel(info)); pkgicon = pmUser.getApplicationIcon(info); appUid = info.uid; } } catch (NameNotFoundException e) { // app is gone, just show package name and generic icon pkgicon = pmUser.getDefaultActivityIcon(); } ((ImageView) row.findViewById(android.R.id.icon)).setImageDrawable(pkgicon); ((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() { public void onClick(View v) { 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); View vetoButton = updateNotificationVetoButton(row, sbn); vetoButton.setContentDescription(mContext.getString( Loading Loading @@ -1432,7 +1450,7 @@ public abstract class BaseStatusBar extends SystemUI implements row.setUserExpanded(userExpanded); } row.setUserLocked(userLocked); row.setStatusBarNotification(entry.notification); return true; } Loading Loading @@ -1946,6 +1964,7 @@ public abstract class BaseStatusBar extends SystemUI implements } else { entry.row.setOnClickListener(null); } entry.row.setStatusBarNotification(notification); entry.row.notifyContentUpdated(); entry.row.resetHeight(); } Loading packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +27 −3 Original line number Diff line number Diff line Loading @@ -20,9 +20,11 @@ import android.content.Context; import android.graphics.drawable.AnimatedVectorDrawable; import android.graphics.drawable.AnimationDrawable; import android.graphics.drawable.Drawable; import android.service.notification.StatusBarNotification; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import android.view.ViewStub; import android.view.accessibility.AccessibilityEvent; import android.widget.ImageView; Loading Loading @@ -67,6 +69,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { private boolean mWasReset; private NotificationGuts mGuts; private StatusBarNotification mStatusBarNotification; public void setIconAnimationRunning(boolean running) { setIconAnimationRunning(running, mPublicLayout); setIconAnimationRunning(running, mPrivateLayout); Loading Loading @@ -112,6 +116,14 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { } } public void setStatusBarNotification(StatusBarNotification statusBarNotification) { mStatusBarNotification = statusBarNotification; } public StatusBarNotification getStatusBarNotification() { return mStatusBarNotification; } public interface ExpansionLogger { public void logNotificationExpansion(String key, boolean userAction, boolean expanded); } Loading Loading @@ -155,7 +167,15 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { super.onFinishInflate(); mPublicLayout = (NotificationContentView) findViewById(R.id.expandedPublic); mPrivateLayout = (NotificationContentView) findViewById(R.id.expanded); mGuts = (NotificationGuts) findViewById(R.id.notification_guts); ViewStub gutsStub = (ViewStub) findViewById(R.id.notification_guts_stub); gutsStub.setOnInflateListener(new ViewStub.OnInflateListener() { @Override public void onInflate(ViewStub stub, View inflated) { mGuts = (NotificationGuts) inflated; mGuts.setClipTopAmount(getClipTopAmount()); mGuts.setActualHeight(getActualHeight()); } }); mVetoButton = findViewById(R.id.veto); } Loading Loading @@ -421,7 +441,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { public void setActualHeight(int height, boolean notifyListeners) { mPrivateLayout.setActualHeight(height); mPublicLayout.setActualHeight(height); if (mGuts != null) { mGuts.setActualHeight(height); } invalidate(); super.setActualHeight(height, notifyListeners); } Loading @@ -443,8 +465,10 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { super.setClipTopAmount(clipTopAmount); mPrivateLayout.setClipTopAmount(clipTopAmount); mPublicLayout.setClipTopAmount(clipTopAmount); if (mGuts != null) { mGuts.setClipTopAmount(clipTopAmount); } } public void notifyContentUpdated() { mPublicLayout.notifyContentUpdated(); Loading Loading
packages/SystemUI/res/layout/status_bar_notification_row.xml +4 −3 Original line number Diff line number Diff line Loading @@ -52,9 +52,10 @@ android:paddingStart="8dp" /> <include layout="@layout/notification_guts" android:id="@+id/notification_guts" <ViewStub android:layout="@layout/notification_guts" android:id="@+id/notification_guts_stub" android:inflatedId="@+id/notification_guts" android:layout_width="match_parent" android:layout_height="match_parent" /> Loading
packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +81 −62 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ import android.view.View; import android.view.ViewAnimationUtils; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; import android.view.ViewStub; import android.view.WindowManager; import android.view.WindowManagerGlobal; import android.view.accessibility.AccessibilityManager; Loading Loading @@ -764,17 +765,95 @@ public abstract class BaseStatusBar extends SystemUI implements }, false /* afterKeyguardGone */); } private void inflateGuts(ExpandableNotificationRow row) { ViewStub stub = (ViewStub) row.findViewById(R.id.notification_guts_stub); if (stub != null) { stub.inflate(); } final StatusBarNotification sbn = row.getStatusBarNotification(); PackageManager pmUser = getPackageManagerForUser( sbn.getUser().getIdentifier()); row.setTag(sbn.getPackageName()); final View guts = row.findViewById(R.id.notification_guts); final String pkg = sbn.getPackageName(); String appname = pkg; Drawable pkgicon = null; int appUid = -1; try { final ApplicationInfo info = pmUser.getApplicationInfo(pkg, PackageManager.GET_UNINSTALLED_PACKAGES | PackageManager.GET_DISABLED_COMPONENTS); if (info != null) { appname = String.valueOf(pmUser.getApplicationLabel(info)); pkgicon = pmUser.getApplicationIcon(info); appUid = info.uid; } } catch (NameNotFoundException e) { // app is gone, just show package name and generic icon pkgicon = pmUser.getDefaultActivityIcon(); } ((ImageView) row.findViewById(android.R.id.icon)).setImageDrawable(pkgicon); ((DateTimeView) row.findViewById(R.id.timestamp)).setTime(sbn.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() { public void onClick(View v) { 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 { appSettingsButton.setVisibility(View.GONE); } } else { settingsButton.setVisibility(View.GONE); appSettingsButton.setVisibility(View.GONE); } } protected SwipeHelper.LongPressListener getNotificationLongClicker() { return new SwipeHelper.LongPressListener() { @Override public boolean onLongPress(View v, int x, int y) { dismissPopups(); if (!(v instanceof ExpandableNotificationRow)) { return false; } if (v.getWindowToken() == null) { Log.e(TAG, "Trying to show notification guts, but not attached to window"); return false; } inflateGuts((ExpandableNotificationRow) v); // Assume we are a status_bar_notification_row final NotificationGuts guts = (NotificationGuts) v.findViewById( R.id.notification_guts); Loading Loading @@ -1190,67 +1269,6 @@ public abstract class BaseStatusBar extends SystemUI implements row.setExpansionLogger(this, entry.notification.getKey()); } // the notification inspector (see SwipeHelper.setLongPressListener) row.setTag(sbn.getPackageName()); final View guts = row.findViewById(R.id.notification_guts); final String pkg = entry.notification.getPackageName(); String appname = pkg; Drawable pkgicon = null; int appUid = -1; try { final ApplicationInfo info = pmUser.getApplicationInfo(pkg, PackageManager.GET_UNINSTALLED_PACKAGES | PackageManager.GET_DISABLED_COMPONENTS); if (info != null) { appname = String.valueOf(pmUser.getApplicationLabel(info)); pkgicon = pmUser.getApplicationIcon(info); appUid = info.uid; } } catch (NameNotFoundException e) { // app is gone, just show package name and generic icon pkgicon = pmUser.getDefaultActivityIcon(); } ((ImageView) row.findViewById(android.R.id.icon)).setImageDrawable(pkgicon); ((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() { public void onClick(View v) { 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); View vetoButton = updateNotificationVetoButton(row, sbn); vetoButton.setContentDescription(mContext.getString( Loading Loading @@ -1432,7 +1450,7 @@ public abstract class BaseStatusBar extends SystemUI implements row.setUserExpanded(userExpanded); } row.setUserLocked(userLocked); row.setStatusBarNotification(entry.notification); return true; } Loading Loading @@ -1946,6 +1964,7 @@ public abstract class BaseStatusBar extends SystemUI implements } else { entry.row.setOnClickListener(null); } entry.row.setStatusBarNotification(notification); entry.row.notifyContentUpdated(); entry.row.resetHeight(); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +27 −3 Original line number Diff line number Diff line Loading @@ -20,9 +20,11 @@ import android.content.Context; import android.graphics.drawable.AnimatedVectorDrawable; import android.graphics.drawable.AnimationDrawable; import android.graphics.drawable.Drawable; import android.service.notification.StatusBarNotification; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import android.view.ViewStub; import android.view.accessibility.AccessibilityEvent; import android.widget.ImageView; Loading Loading @@ -67,6 +69,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { private boolean mWasReset; private NotificationGuts mGuts; private StatusBarNotification mStatusBarNotification; public void setIconAnimationRunning(boolean running) { setIconAnimationRunning(running, mPublicLayout); setIconAnimationRunning(running, mPrivateLayout); Loading Loading @@ -112,6 +116,14 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { } } public void setStatusBarNotification(StatusBarNotification statusBarNotification) { mStatusBarNotification = statusBarNotification; } public StatusBarNotification getStatusBarNotification() { return mStatusBarNotification; } public interface ExpansionLogger { public void logNotificationExpansion(String key, boolean userAction, boolean expanded); } Loading Loading @@ -155,7 +167,15 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { super.onFinishInflate(); mPublicLayout = (NotificationContentView) findViewById(R.id.expandedPublic); mPrivateLayout = (NotificationContentView) findViewById(R.id.expanded); mGuts = (NotificationGuts) findViewById(R.id.notification_guts); ViewStub gutsStub = (ViewStub) findViewById(R.id.notification_guts_stub); gutsStub.setOnInflateListener(new ViewStub.OnInflateListener() { @Override public void onInflate(ViewStub stub, View inflated) { mGuts = (NotificationGuts) inflated; mGuts.setClipTopAmount(getClipTopAmount()); mGuts.setActualHeight(getActualHeight()); } }); mVetoButton = findViewById(R.id.veto); } Loading Loading @@ -421,7 +441,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { public void setActualHeight(int height, boolean notifyListeners) { mPrivateLayout.setActualHeight(height); mPublicLayout.setActualHeight(height); if (mGuts != null) { mGuts.setActualHeight(height); } invalidate(); super.setActualHeight(height, notifyListeners); } Loading @@ -443,8 +465,10 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { super.setClipTopAmount(clipTopAmount); mPrivateLayout.setClipTopAmount(clipTopAmount); mPublicLayout.setClipTopAmount(clipTopAmount); if (mGuts != null) { mGuts.setClipTopAmount(clipTopAmount); } } public void notifyContentUpdated() { mPublicLayout.notifyContentUpdated(); Loading