diff options
author | Brandon Maxwell <maxwelb@google.com> | 2016-03-10 20:08:31 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-03-10 20:08:31 +0000 |
commit | d90042c1e63d80622b94d6a9ecd6f8e582c20472 (patch) | |
tree | 676780e60612b631d3f512728c372740960631a7 /src/com/android/dialer/calllog | |
parent | 8adea5dbf1bea0e6c0b944c562230d962a46d038 (diff) | |
parent | d34a408c71e8f791f74c5b19e5c8d5cb2a710522 (diff) |
Merge "Fixing missed call notifications for FBE" into nyc-dev am: bb293bfd56
am: d34a408c71
* commit 'd34a408c71e8f791f74c5b19e5c8d5cb2a710522':
Fixing missed call notifications for FBE
Diffstat (limited to 'src/com/android/dialer/calllog')
-rw-r--r-- | src/com/android/dialer/calllog/MissedCallNotifier.java | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/src/com/android/dialer/calllog/MissedCallNotifier.java b/src/com/android/dialer/calllog/MissedCallNotifier.java index c422dd58d..98d02d095 100644 --- a/src/com/android/dialer/calllog/MissedCallNotifier.java +++ b/src/com/android/dialer/calllog/MissedCallNotifier.java @@ -33,6 +33,7 @@ import com.android.dialer.DialtactsActivity; import com.android.dialer.R; import com.android.dialer.calllog.CallLogNotificationsHelper.NewCall; import com.android.dialer.contactinfo.ContactPhotoLoader; +import com.android.dialer.compat.UserManagerCompat; import com.android.dialer.list.ListsFragment; import com.android.dialer.util.DialerUtils; import com.android.dialer.util.IntentUtil; @@ -153,8 +154,8 @@ public class MissedCallNotifier { // sensitive notification information. .setPublicVersion(publicBuilder.build()); - // Add additional actions when there is only 1 missed call, like call-back and SMS. - if (count == 1) { + // Add additional actions when there is only 1 missed call and the user isn't locked + if (UserManagerCompat.isUserUnlocked(mContext) && count == 1) { if (!TextUtils.isEmpty(number) && !TextUtils.equals( number, mContext.getString(R.string.handle_restricted))) { @@ -181,21 +182,24 @@ public class MissedCallNotifier { AsyncTask.execute(new Runnable() { @Override public void run() { - // Clear the list of new missed calls from the call log. - ContentValues values = new ContentValues(); - values.put(Calls.NEW, 0); - values.put(Calls.IS_READ, 1); - StringBuilder where = new StringBuilder(); - where.append(Calls.NEW); - where.append(" = 1 AND "); - where.append(Calls.TYPE); - where.append(" = ?"); - try { - mContext.getContentResolver().update(Calls.CONTENT_URI, values, - where.toString(), new String[]{ Integer.toString(Calls. - MISSED_TYPE) }); - } catch (IllegalArgumentException e) { - Log.w(TAG, "ContactsProvider update command failed", e); + // Call log is only accessible when unlocked. If that's the case, clear the list of + // new missed calls from the call log. + if (UserManagerCompat.isUserUnlocked(mContext)) { + ContentValues values = new ContentValues(); + values.put(Calls.NEW, 0); + values.put(Calls.IS_READ, 1); + StringBuilder where = new StringBuilder(); + where.append(Calls.NEW); + where.append(" = 1 AND "); + where.append(Calls.TYPE); + where.append(" = ?"); + try { + mContext.getContentResolver().update(Calls.CONTENT_URI, values, + where.toString(), new String[]{Integer.toString(Calls. + MISSED_TYPE)}); + } catch (IllegalArgumentException e) { + Log.w(TAG, "ContactsProvider update command failed", e); + } } getNotificationMgr().cancel(NOTIFICATION_TAG, NOTIFICATION_ID); } |