From 9c327dac16eeb5bdf1a28eb64ce0c9ac7b73158c Mon Sep 17 00:00:00 2001 From: linyuh Date: Tue, 14 Nov 2017 12:33:48 -0800 Subject: Move InCallActivityCommon#dismissKeyGuard to InCallActivity. This is part of the effort to delete InCallActivityCommon. There are 25 references to InCallActivityCommon in InCallActivity and we will remove them one at a time. Bug: 69272096 Test: None PiperOrigin-RevId: 175718978 Change-Id: I0713bd28c2d34791045be2bb851003000b88abca --- java/com/android/incallui/InCallActivity.java | 13 ++++++++++++- java/com/android/incallui/InCallActivityCommon.java | 15 +-------------- 2 files changed, 13 insertions(+), 15 deletions(-) (limited to 'java') diff --git a/java/com/android/incallui/InCallActivity.java b/java/com/android/incallui/InCallActivity.java index cdab6b4f5..93534697c 100644 --- a/java/com/android/incallui/InCallActivity.java +++ b/java/com/android/incallui/InCallActivity.java @@ -34,6 +34,7 @@ import android.view.KeyEvent; import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; +import android.view.WindowManager; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.common.concurrent.ThreadUtil; @@ -90,6 +91,7 @@ public class InCallActivity extends TransactionSafeFragmentActivity private boolean didShowAnswerScreen; private boolean didShowInCallScreen; private boolean didShowVideoCallScreen; + private boolean dismissKeyguard; private int[] backgroundDrawableColors; private GradientDrawable backgroundDrawable; private boolean isVisible; @@ -419,7 +421,16 @@ public class InCallActivity extends TransactionSafeFragmentActivity } public void dismissKeyguard(boolean dismiss) { - common.dismissKeyguard(dismiss); + if (dismissKeyguard == dismiss) { + return; + } + + dismissKeyguard = dismiss; + if (dismiss) { + getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); + } else { + getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); + } } public void showPostCharWaitDialog(String callId, String chars) { diff --git a/java/com/android/incallui/InCallActivityCommon.java b/java/com/android/incallui/InCallActivityCommon.java index 5a5d770d0..e97e6a001 100644 --- a/java/com/android/incallui/InCallActivityCommon.java +++ b/java/com/android/incallui/InCallActivityCommon.java @@ -102,7 +102,6 @@ public class InCallActivityCommon { private static Optional audioRouteForTesting = Optional.absent(); private final InCallActivity inCallActivity; - private boolean dismissKeyguard; private boolean showPostCharWaitDialogOnResume; private String showPostCharWaitDialogCallId; private String showPostCharWaitDialogChars; @@ -525,18 +524,6 @@ public class InCallActivityCommon { return false; } - public void dismissKeyguard(boolean dismiss) { - if (dismissKeyguard == dismiss) { - return; - } - dismissKeyguard = dismiss; - if (dismiss) { - inCallActivity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); - } else { - inCallActivity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); - } - } - public void showPostCharWaitDialog(String callId, String chars) { if (inCallActivity.isVisible()) { PostCharDialogFragment fragment = new PostCharDialogFragment(callId, chars); @@ -902,7 +889,7 @@ public class InCallActivityCommon { outgoingCall.disconnect(); } - dismissKeyguard(true); + inCallActivity.dismissKeyguard(true); } boolean didShowAccountSelectionDialog = maybeShowAccountSelectionDialog(); -- cgit v1.2.3 From 1569826821d3de13d580a33a570057c1445741f7 Mon Sep 17 00:00:00 2001 From: twyen Date: Tue, 14 Nov 2017 16:52:54 -0800 Subject: Use phone account ID for legacy voicemail notification. This allows one notification per SIM to be shown on multi SIM devices Bug: 64010653 Test: LegacyVoicemailNotifierTest PiperOrigin-RevId: 175756590 Change-Id: I8c2fe3ec06c5e6868ddc647742ab9ef422494b3b --- .../dialer/app/calllog/LegacyVoicemailNotifier.java | 20 +++++++++++++++++--- .../LegacyVoicemailNotificationReceiver.java | 2 +- 2 files changed, 18 insertions(+), 4 deletions(-) (limited to 'java') diff --git a/java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java b/java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java index 584f07fe3..a0bbfa0f1 100644 --- a/java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java +++ b/java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java @@ -40,6 +40,7 @@ import com.android.dialer.notification.NotificationChannelManager; /** Shows a notification in the status bar for legacy vociemail. */ @TargetApi(VERSION_CODES.O) public final class LegacyVoicemailNotifier { + private static final String NOTIFICATION_TAG_PREFIX = "LegacyVoicemail_"; private static final String NOTIFICATION_TAG = "LegacyVoicemail"; private static final int NOTIFICATION_ID = 1; @@ -77,7 +78,8 @@ public final class LegacyVoicemailNotifier { callVoicemailIntent, voicemailSettingsIntent, isRefresh); - DialerNotificationManager.notify(context, NOTIFICATION_TAG, NOTIFICATION_ID, notification); + DialerNotificationManager.notify( + context, getNotificationTag(context, handle), NOTIFICATION_ID, notification); } @NonNull @@ -146,10 +148,22 @@ public final class LegacyVoicemailNotifier { } } - public static void cancelNotification(@NonNull Context context) { + public static void cancelNotification( + @NonNull Context context, @NonNull PhoneAccountHandle phoneAccountHandle) { LogUtil.enterBlock("LegacyVoicemailNotifier.cancelNotification"); Assert.checkArgument(BuildCompat.isAtLeastO()); - DialerNotificationManager.cancel(context, NOTIFICATION_TAG, NOTIFICATION_ID); + Assert.isNotNull(phoneAccountHandle); + DialerNotificationManager.cancel( + context, getNotificationTag(context, phoneAccountHandle), NOTIFICATION_ID); + } + + @NonNull + private static String getNotificationTag( + @NonNull Context context, @NonNull PhoneAccountHandle phoneAccountHandle) { + if (context.getSystemService(TelephonyManager.class).getPhoneCount() <= 1) { + return NOTIFICATION_TAG; + } + return NOTIFICATION_TAG_PREFIX + phoneAccountHandle.getId(); } private LegacyVoicemailNotifier() {} diff --git a/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java b/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java index 3ce837b8c..fee845469 100644 --- a/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java +++ b/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java @@ -96,7 +96,7 @@ public class LegacyVoicemailNotificationReceiver extends BroadcastReceiver { if (count == 0) { LogUtil.i("LegacyVoicemailNotificationReceiver.onReceive", "clearing notification"); - LegacyVoicemailNotifier.cancelNotification(context); + LegacyVoicemailNotifier.cancelNotification(context, phoneAccountHandle); return; } -- cgit v1.2.3 From 725c2514c529e4542eeeca30fccf8eb7ad407dc1 Mon Sep 17 00:00:00 2001 From: twyen Date: Tue, 14 Nov 2017 18:55:46 -0800 Subject: Notify content URI when preferred SIM is updated Test: PreferredSimFallBackProviderTest PiperOrigin-RevId: 175769540 Change-Id: Ie4e33f32ae9e99da92baa9906a3576df31b1b0a3 --- .../android/dialer/preferredsim/impl/PreferredSimFallbackProvider.java | 1 + 1 file changed, 1 insertion(+) (limited to 'java') diff --git a/java/com/android/dialer/preferredsim/impl/PreferredSimFallbackProvider.java b/java/com/android/dialer/preferredsim/impl/PreferredSimFallbackProvider.java index 322baa2ef..1b10765a5 100644 --- a/java/com/android/dialer/preferredsim/impl/PreferredSimFallbackProvider.java +++ b/java/com/android/dialer/preferredsim/impl/PreferredSimFallbackProvider.java @@ -131,6 +131,7 @@ public class PreferredSimFallbackProvider extends ContentProvider { == -1) { throw new IllegalStateException("update failed"); } + getContext().getContentResolver().notifyChange(PreferredSimFallbackContract.CONTENT_URI, null); return 1; } -- cgit v1.2.3 From 9c5d723468ff0046419d286729060221f00f7577 Mon Sep 17 00:00:00 2001 From: uabdullah Date: Wed, 15 Nov 2017 10:24:04 -0800 Subject: Replace NUI voicemail media buttons with image buttons Replaces the existing buttons with Image Buttons using standards images. Also added a phone button. Bug: 64882313,68382421 Test: Unit Tests PiperOrigin-RevId: 175843834 Change-Id: I21898f7da72f3dd17fce0047b11349737b373513 --- .../listui/NewVoicemailMediaPlayerView.java | 22 +++++++++--- .../layout/new_voicemail_media_player_layout.xml | 42 ++++++++++++++-------- .../dialer/voicemail/listui/res/values/dimens.xml | 5 +++ .../dialer/voicemail/listui/res/values/styles.xml | 25 +++++++++++++ 4 files changed, 76 insertions(+), 18 deletions(-) create mode 100644 java/com/android/dialer/voicemail/listui/res/values/styles.xml (limited to 'java') diff --git a/java/com/android/dialer/voicemail/listui/NewVoicemailMediaPlayerView.java b/java/com/android/dialer/voicemail/listui/NewVoicemailMediaPlayerView.java index 4629ce277..d5db60846 100644 --- a/java/com/android/dialer/voicemail/listui/NewVoicemailMediaPlayerView.java +++ b/java/com/android/dialer/voicemail/listui/NewVoicemailMediaPlayerView.java @@ -30,7 +30,7 @@ import android.support.v4.util.Pair; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; -import android.widget.Button; +import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.TextView; import com.android.dialer.common.Assert; @@ -45,9 +45,10 @@ import com.android.dialer.voicemail.model.VoicemailEntry; */ public class NewVoicemailMediaPlayerView extends LinearLayout { - private Button playButton; - private Button speakerButton; - private Button deleteButton; + private ImageButton playButton; + private ImageButton speakerButton; + private ImageButton phoneButton; + private ImageButton deleteButton; private TextView totalDurationView; private Uri voicemailUri; private FragmentManager fragmentManager; @@ -72,6 +73,7 @@ public class NewVoicemailMediaPlayerView extends LinearLayout { private void initializeMediaPlayerButtonsAndViews() { playButton = findViewById(R.id.playButton); speakerButton = findViewById(R.id.speakerButton); + phoneButton = findViewById(R.id.phoneButton); deleteButton = findViewById(R.id.deleteButton); totalDurationView = findViewById(R.id.playback_seek_total_duration); } @@ -79,6 +81,7 @@ public class NewVoicemailMediaPlayerView extends LinearLayout { private void setupListenersForMediaPlayerButtons() { playButton.setOnClickListener(playButtonListener); speakerButton.setOnClickListener(speakerButtonListener); + phoneButton.setOnClickListener(phoneButtonListener); deleteButton.setOnClickListener(deleteButtonListener); } @@ -164,6 +167,17 @@ public class NewVoicemailMediaPlayerView extends LinearLayout { } }; + private final View.OnClickListener phoneButtonListener = + new View.OnClickListener() { + @Override + public void onClick(View view) { + LogUtil.i( + "NewVoicemailMediaPlayer.phoneButtonListener", + "speaker request for voicemailUri: %s", + voicemailUri.toString()); + } + }; + private final View.OnClickListener deleteButtonListener = new View.OnClickListener() { @Override diff --git a/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_media_player_layout.xml b/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_media_player_layout.xml index e8e560059..07ce86a1d 100644 --- a/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_media_player_layout.xml +++ b/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_media_player_layout.xml @@ -67,22 +67,36 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:paddingTop="10dp" - android:orientation="horizontal"> - -