From 328e2d26663be87b7f6f03deb933d0fa21503511 Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Thu, 17 Jan 2013 13:14:02 -0500 Subject: [PATCH] Show the user's list of notifications in Settings. Requires new APIs in change I41338230 and change Icce8d6f9 from frameworks/base. Change-Id: I21b645bdc265b477453f9b177f6776e2c58bd323 --- AndroidManifest.xml | 14 + res/drawable-hdpi/ic_settings_notifications.png | Bin 0 -> 1307 bytes res/drawable-mdpi/ic_settings_notifications.png | Bin 0 -> 967 bytes res/drawable-xhdpi/ic_settings_notifications.png | Bin 0 -> 4637 bytes res/layout/notification_info_row.xml | 115 ++++++++ res/layout/notification_log_row.xml | 96 ++++++ res/values/arrays.xml | 2 + src/com/android/settings/NotificationStation.java | 321 +++++++++++++++++++++ src/com/android/settings/Settings.java | 1 + .../android/settings/applications/AppOpsState.java | 1 + 10 files changed, 550 insertions(+) create mode 100644 res/drawable-hdpi/ic_settings_notifications.png create mode 100644 res/drawable-mdpi/ic_settings_notifications.png create mode 100644 res/drawable-xhdpi/ic_settings_notifications.png create mode 100644 res/layout/notification_info_row.xml create mode 100644 res/layout/notification_log_row.xml create mode 100644 src/com/android/settings/NotificationStation.java diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 78b16bb009..e68a068ab1 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -62,6 +62,7 @@ + + + + + + + + + + !lvI6;x#X;^) z4C~IxyaaL-l0AZa85pY67#JE_7#My5g&JNkFq8sKd6mGxU^Rn*LA+qju0R{0zQO>X z5Lcjr|D%A8A<)rOITIM@RV6`w!N5ph=VW4L6}Arwwq)ThX;5go^zzl2bV0HA{IwrM zO^zk~c+L^`HPG;g9N*&$Ka>& zmps$8-~X)8`nytn!xF_E3uVRaTwSi3pWeykv1RMFrOjo$?r)tw-bswOmaH)cl&~0+ zyxm*nCLvE3#}JR>cc=XhzU&}yytw-2?k-=g z8FozDI>K}p{ovA?7cpTQ$B!fBwPG$uze~T2e}7l?WsmWf9r7~@kDX63x;gXrxwmiY zHg`V$qc7n5exd!|uM6}m7q4UFdRdjyQV^najCX?x@0mA}H)emGU}(Snyu&&7t?UO6 zF8u4bFF>bIjIW%Rr@hCMu}4N@wSmU3I8_7ArY<1?8C!|tt&VxB1;_c0etgKdK`5kO z#+T*z1-+%WDrEZQw|kvb6t>*^=7{HRXKNO<;^ltxEvxlDU0AhdQ(^Gd&*FMPY)9tr zOG&WGn-k;_U9sZKk(G>$oqwmic3?LMG%}dP@uaGsYun_lqM2TQKAo9rrOK23e4W&c z*;m`kIArJMo1{k_N`Bb1(u;eSS4&5B_u0Ji%%4?P&(*v+_Q+RMPxt;Np#{-0 zS>w(l+unUW-=uYWu)s6l)U&U(F7}qc)V|$#VG;kC)qDRh`0-<9imJmJ{@QCbKeJ3v ztoW_lxxc*QEZ?GEi(~$+{2>~3HtfjBvu6#DzUSSta?+bH)1NJhZqdu^a$Gw$eh*N7 z+a8#qaOhslrswhh72mMcGpt^^-Am=NJ*Y@hEpd$~Nl7e8wMs5Z1yT$~28PDE28OzZ z<{^e=R)&^VCT6+@rd9?9FD@)zkD?(rKP5A*61Rq#z0$yh$iU#~>gTe~DWM4fa5eI~ literal 0 HcmV?d00001 diff --git a/res/drawable-mdpi/ic_settings_notifications.png b/res/drawable-mdpi/ic_settings_notifications.png new file mode 100644 index 0000000000000000000000000000000000000000..fa7a07c0202b35134020b8afcc79b18bb7641b36 GIT binary patch literal 967 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyEa{HEjtmSN`?>!lvI6;x#X;^) z4C~IxyacIC_6YK2V5m}KU}$JzVE6?TYIwoGP-?)y@G60U!DwWflZB)YHe3<~RP#laX!u zXIB5v)a25y8T_7e*VLVS@`yuGP1Qb&udu=OqVt8Hvwu4-d9&hWnhTpwWP~5*-@DR_ z<}c_KynkHc-03r0#N?v7UKar^VodUOcVYa`qIdtj@UZJPy%*Z{&pVV~F!_;B zXznM8sJDKz#N6y31r>-j*{Mm#c6kVV)6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!}grW53 z_;iXziEDq(k{^cG42-7s)FH#F=UfBy=3!c>@;ZD|(rl2;qH0PmNPlQ3y_0KY5$vd~ z5mrZ0F881T99rr+K>V4J|7?5iIK>|KWY+%-==sE;coDpU%F4*=XrA-<%(E5(G{qMu z1J3UtMP)(mq0Ni@l7}ET3p;75a4}*vhd|OB)Iy=L3kyq?eX~Ti**&M^d99JG>3)@7 zCUd@L7j0*~AO9Jok+z4Ri)%X=LM z?;k&!$GGt5;kCG+dzxsiRSx+CAM=%}S^;9!DV+HGu&A|EKCN{XrwLT=b2tY}0(K^g zJlHzMQ2%<@OivgAdM)cz0M&Lkfg_ea#XP{{)KCJW8 z937RR`L)rZMm~GkpqgqQ>>Xb4N| zL_;RDGQG7?cpbmj;Eo&}ibyGcVrfb*?0d~U(Yz3@67vmOJ(wHYC%eyq9F_af@V4-y zd*`_~W(j6dd|Vhn&g8tCC8p?8vHsXBelDJSTt!MYfVDQ@f=qVbJ|bJSe;Y4zoAFLP zS!xi8GL5$NH|CCb42O*UZ-rU+9o{lOu>sB$jBfhV0}ok!H!M=_ zfXi+Zo1k>rPU*@HXsx2pZHPOzM}D5XvOVFy>n=t#Fl!Oi?8fMWSm%GPS^Bcb0F6Gt zrG5ZJ$K@3D>Rr1}6N>~-a$F=`P}OyPU!~-TLTQm12I4HzSG?eQ75hwg?M!lkllc%} z%`SECO^}YJ%^n$pNZ+G%E`=@wf|Z~m*sWgQfv`rF^d-mh zN@2W$mDQ?|8!?Rm%<6k&1EjP48ELuNM^0+s~$pTGYus_!(;tPGLxW rTkrG|=rZUR9qRHD$fas0;C9LePnI9n&UMzgI%DA~TFNzwmf`;Zicx96 literal 0 HcmV?d00001 diff --git a/res/layout/notification_info_row.xml b/res/layout/notification_info_row.xml new file mode 100644 index 0000000000..bc71ef2594 --- /dev/null +++ b/res/layout/notification_info_row.xml @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/layout/notification_log_row.xml b/res/layout/notification_log_row.xml new file mode 100644 index 0000000000..26e72cb77e --- /dev/null +++ b/res/layout/notification_log_row.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/values/arrays.xml b/res/values/arrays.xml index 4c3d4b737a..ccd803de7d 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -588,6 +588,7 @@ write ICC SMS modify settings draw on top + access notifications @@ -617,6 +618,7 @@ Send SMS/MMS Modify settings Draw on top + Access notifications diff --git a/src/com/android/settings/NotificationStation.java b/src/com/android/settings/NotificationStation.java new file mode 100644 index 0000000000..62f1c30f44 --- /dev/null +++ b/src/com/android/settings/NotificationStation.java @@ -0,0 +1,321 @@ +/* + * 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.Activity; +import android.app.ActivityManager; +import android.app.INotificationManager; +import android.app.Notification; +import android.app.NotificationManager; +import android.app.TaskStackBuilder; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.content.pm.PackageManager; +import android.content.res.Resources; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteException; +import android.graphics.drawable.Drawable; +import android.net.Uri; +import android.os.Bundle; +import android.os.RemoteException; +import android.os.ServiceManager; +import android.os.UserHandle; +import android.provider.*; +import android.util.Log; +import android.util.Slog; +import android.view.LayoutInflater; +import android.view.MotionEvent; +import android.view.View; +import android.view.View.OnClickListener; +import android.view.View.OnTouchListener; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.DateTimeView; +import android.widget.ImageView; +import android.widget.ListView; +import android.widget.RadioButton; +import android.widget.TextView; +import com.android.internal.statusbar.StatusBarNotification; +import com.android.settings.DreamBackend.DreamInfo; + +import java.util.ArrayList; +import java.util.List; + +public class NotificationStation extends SettingsPreferenceFragment { + private static final String TAG = NotificationStation.class.getSimpleName(); + static final boolean DEBUG = true; + private static final String PACKAGE_SCHEME = "package"; + + private final PackageReceiver mPackageReceiver = new PackageReceiver(); + private INotificationManager mNoMan; + + private NotificationHistoryAdapter mAdapter; + private Context mContext; + + @Override + public void onAttach(Activity activity) { + logd("onAttach(%s)", activity.getClass().getSimpleName()); + super.onAttach(activity); + mContext = activity; + mNoMan = INotificationManager.Stub.asInterface( + ServiceManager.getService(Context.NOTIFICATION_SERVICE)); + } + + @Override + public void onCreate(Bundle icicle) { + logd("onCreate(%s)", icicle); + super.onCreate(icicle); + Activity activity = getActivity(); + } + + @Override + public void onDestroyView() { + super.onDestroyView(); + } + + @Override + public void onActivityCreated(Bundle savedInstanceState) { + logd("onActivityCreated(%s)", savedInstanceState); + super.onActivityCreated(savedInstanceState); + + ListView listView = getListView(); + +// TextView emptyView = (TextView) getView().findViewById(android.R.id.empty); +// emptyView.setText(R.string.screensaver_settings_disabled_prompt); +// listView.setEmptyView(emptyView); + + mAdapter = new NotificationHistoryAdapter(mContext); + listView.setAdapter(mAdapter); + } + + @Override + public void onPause() { + logd("onPause()"); + super.onPause(); + mContext.unregisterReceiver(mPackageReceiver); + } + + @Override + public void onResume() { + logd("onResume()"); + super.onResume(); + refreshFromBackend(); + + // listen for package changes + IntentFilter filter = new IntentFilter(); + filter.addAction(Intent.ACTION_PACKAGE_ADDED); + filter.addAction(Intent.ACTION_PACKAGE_CHANGED); + filter.addAction(Intent.ACTION_PACKAGE_REMOVED); + filter.addAction(Intent.ACTION_PACKAGE_REPLACED); + filter.addDataScheme(PACKAGE_SCHEME); + mContext.registerReceiver(mPackageReceiver , filter); + } + + private void refreshFromBackend() { + List infos = loadNotifications(); + if (infos != null) { + logd("adding %d infos", infos.size()); + mAdapter.clear(); + mAdapter.addAll(infos); + } + } + + private static void logd(String msg, Object... args) { + if (DEBUG) + Log.d(TAG, args == null || args.length == 0 ? msg : String.format(msg, args)); + } + + private static class HistoricalNotificationInfo { + public String pkg; + public Drawable pkgicon; + public Drawable icon; + public CharSequence title; + public int priority; + public int user; + public long timestamp; + } + + private List loadNotifications() { + final int currentUserId = ActivityManager.getCurrentUser(); + try { + StatusBarNotification[] nions = mNoMan.getHistoricalNotifications( + mContext.getPackageName(), 100); + List list + = new ArrayList(nions.length); + + for (StatusBarNotification sbn : nions) { + final HistoricalNotificationInfo info = new HistoricalNotificationInfo(); + info.pkg = sbn.pkg; + info.user = sbn.getUserId(); + info.icon = loadIconDrawable(info.pkg, info.user, sbn.notification.icon); + info.pkgicon = loadPackageIconDrawable(info.pkg, info.user); + if (sbn.notification.extras != null) { + info.title = sbn.notification.extras.getString(Notification.EXTRA_TITLE); + } + info.timestamp = sbn.postTime; + info.priority = sbn.notification.priority; + logd(" [%d] %s: %s", info.timestamp, info.pkg, info.title); + + if (info.user == UserHandle.USER_ALL + || info.user == currentUserId) { + list.add(info); + } + } + + return list; + } catch (RemoteException e) { + e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. + } + return null; + } + + private Resources getResourcesForUserPackage(String pkg, int userId) { + Resources r = null; + + if (pkg != null) { + try { + if (userId == UserHandle.USER_ALL) { + userId = UserHandle.USER_OWNER; + } + r = mContext.getPackageManager() + .getResourcesForApplicationAsUser(pkg, userId); + } catch (PackageManager.NameNotFoundException ex) { + Log.e(TAG, "Icon package not found: " + pkg); + return null; + } + } else { + r = mContext.getResources(); + } + return r; + } + + private Drawable loadPackageIconDrawable(String pkg, int userId) { + Drawable icon = null; + try { + icon = mContext.getPackageManager().getApplicationIcon(pkg); + } catch (PackageManager.NameNotFoundException e) { + } + + return icon; + } + + private Drawable loadIconDrawable(String pkg, int userId, int resId) { + Resources r = getResourcesForUserPackage(pkg, userId); + + if (resId == 0) { + return null; + } + + try { + return r.getDrawable(resId); + } catch (RuntimeException e) { + Log.w(TAG, "Icon not found in " + + (pkg != null ? resId : "") + + ": " + Integer.toHexString(resId)); + } + + return null; + } + + private class NotificationHistoryAdapter extends ArrayAdapter { + private final LayoutInflater mInflater; + + public NotificationHistoryAdapter(Context context) { + super(context, 0); + mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + HistoricalNotificationInfo info = getItem(position); + logd("getView(%s/%s)", info.pkg, info.title); + final View row = convertView != null ? convertView : createRow(parent, info.pkg); + row.setTag(info); + + // bind icon + if (info.icon != null) { + ((ImageView) row.findViewById(android.R.id.icon)).setImageDrawable(info.icon); + } + if (info.pkgicon != null) { + ((ImageView) row.findViewById(R.id.pkgicon)).setImageDrawable(info.pkgicon); + } + + ((DateTimeView) row.findViewById(R.id.timestamp)).setTime(info.timestamp); + + // bind caption + ((TextView) row.findViewById(android.R.id.title)).setText(info.title); + +// // bind radio button +// RadioButton radioButton = (RadioButton) row.findViewById(android.R.id.button1); +// radioButton.setChecked(dreamInfo.isActive); +// radioButton.setOnTouchListener(new OnTouchListener() { +// @Override +// public boolean onTouch(View v, MotionEvent event) { +// row.onTouchEvent(event); +// return false; +// }}); + + // bind settings button + divider +// boolean showSettings = info. +// settingsComponentName != null; +// View settingsDivider = row.findViewById(R.id.divider); +// settingsDivider.setVisibility(false ? View.VISIBLE : View.INVISIBLE); +// +// ImageView settingsButton = (ImageView) row.findViewById(android.R.id.button2); +// settingsButton.setVisibility(false ? View.VISIBLE : View.INVISIBLE); +// settingsButton.setAlpha(info.isActive ? 1f : Utils.DISABLED_ALPHA); +// settingsButton.setEnabled(info.isActive); +// settingsButton.setOnClickListener(new OnClickListener(){ +// @Override +// public void onClick(View v) { +// mBackend.launchSettings((DreamInfo) row.getTag()); +// }}); + + return row; + } + + private View createRow(ViewGroup parent, final String pkg) { + final View row = mInflater.inflate(R.layout.notification_log_row, parent, false); + row.setOnClickListener(new OnClickListener(){ + @Override + public void onClick(View v) { + v.setPressed(true); + startApplicationDetailsActivity(pkg); + }}); + return row; + } + + } + + private void startApplicationDetailsActivity(String packageName) { + Intent intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS, + Uri.fromParts("package", packageName, null)); + intent.setComponent(intent.resolveActivity(mContext.getPackageManager())); + startActivity(intent); + } + + private class PackageReceiver extends BroadcastReceiver { + @Override + public void onReceive(Context context, Intent intent) { + logd("PackageReceiver.onReceive"); + //refreshFromBackend(); + } + } +} diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java index 149561d2ad..f3cceb847a 100644 --- a/src/com/android/settings/Settings.java +++ b/src/com/android/settings/Settings.java @@ -825,4 +825,5 @@ public class Settings extends PreferenceActivity public static class AndroidBeamSettingsActivity extends Settings { /* empty */ } public static class WifiDisplaySettingsActivity extends Settings { /* empty */ } public static class DreamSettingsActivity extends Settings { /* empty */ } + public static class NotificationStationActivity extends Settings { /* empty */ } } diff --git a/src/com/android/settings/applications/AppOpsState.java b/src/com/android/settings/applications/AppOpsState.java index 288977d0c1..47c4fdfe2c 100644 --- a/src/com/android/settings/applications/AppOpsState.java +++ b/src/com/android/settings/applications/AppOpsState.java @@ -148,6 +148,7 @@ public class AppOpsState { public static final OpsTemplate DEVICE_TEMPLATE = new OpsTemplate( new int[] { AppOpsManager.OP_VIBRATE, AppOpsManager.OP_POST_NOTIFICATION, + AppOpsManager.OP_ACCESS_NOTIFICATIONS, AppOpsManager.OP_CALL_PHONE, AppOpsManager.OP_WRITE_SETTINGS, AppOpsManager.OP_SYSTEM_ALERT_WINDOW }, -- 2.11.0