summaryrefslogtreecommitdiffstats
path: root/java/com/android/incallui
diff options
context:
space:
mode:
authoryueg <yueg@google.com>2018-01-31 12:02:19 -0800
committerCopybara-Service <copybara-piper@google.com>2018-01-31 14:03:04 -0800
commitb6e16f578629eee53457a3fc17778f2252102891 (patch)
tree2b662fecbe22614571a9055c264717b0820ec3d0 /java/com/android/incallui
parenta50c9bd73cd75a3bc049a81f2d51b874663b5b21 (diff)
downloadandroid_packages_apps_Dialer-b6e16f578629eee53457a3fc17778f2252102891.tar.gz
android_packages_apps_Dialer-b6e16f578629eee53457a3fc17778f2252102891.tar.bz2
android_packages_apps_Dialer-b6e16f578629eee53457a3fc17778f2252102891.zip
Remove bubble from AOSP.
Bug: 67605985 Test: NewBubbleImplTest, NewBubbleImplIntegrationTest, NewReturnToCallControllerTest PiperOrigin-RevId: 184026033 Change-Id: Ie141ce9a0265ce3a08c01943cdeb94e2cd962e9f
Diffstat (limited to 'java/com/android/incallui')
-rw-r--r--java/com/android/incallui/NewReturnToCallController.java27
1 files changed, 25 insertions, 2 deletions
diff --git a/java/com/android/incallui/NewReturnToCallController.java b/java/com/android/incallui/NewReturnToCallController.java
index 4c3c2a2eb..0b637f89c 100644
--- a/java/com/android/incallui/NewReturnToCallController.java
+++ b/java/com/android/incallui/NewReturnToCallController.java
@@ -21,6 +21,7 @@ import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
+import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.annotation.VisibleForTesting;
import android.telecom.CallAudioState;
@@ -41,6 +42,7 @@ import com.android.incallui.call.DialerCall;
import com.android.incallui.speakerbuttonlogic.SpeakerButtonInfo;
import com.android.incallui.speakerbuttonlogic.SpeakerButtonInfo.IconSize;
import com.android.newbubble.NewBubble;
+import com.android.newbubble.NewBubbleComponent;
import com.android.newbubble.NewBubbleInfo;
import com.android.newbubble.NewBubbleInfo.Action;
import java.lang.ref.WeakReference;
@@ -58,6 +60,8 @@ public class NewReturnToCallController implements InCallUiListener, Listener, Au
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
NewBubble bubble;
+ private static Boolean canShowBubblesForTesting = null;
+
private CallAudioState audioState;
private final PendingIntent toggleSpeaker;
@@ -132,13 +136,32 @@ public class NewReturnToCallController implements InCallUiListener, Listener, Au
startContactInfoSearch();
}
+ /**
+ * Determines whether bubbles can be shown based on permissions obtained. This should be checked
+ * before attempting to create a Bubble.
+ *
+ * @return true iff bubbles are able to be shown.
+ * @see Settings#canDrawOverlays(Context)
+ */
+ private static boolean canShowBubbles(@NonNull Context context) {
+ return canShowBubblesForTesting != null
+ ? canShowBubblesForTesting
+ : Settings.canDrawOverlays(context);
+ }
+
+ @VisibleForTesting(otherwise = VisibleForTesting.NONE)
+ static void setCanShowBubblesForTesting(boolean canShowBubbles) {
+ canShowBubblesForTesting = canShowBubbles;
+ }
+
@VisibleForTesting
public NewBubble startBubble() {
- if (!NewBubble.canShowBubbles(context)) {
+ if (!canShowBubbles(context)) {
LogUtil.i("ReturnToCallController.startNewBubble", "can't show bubble, no permission");
return null;
}
- NewBubble returnToCallBubble = NewBubble.createBubble(context, generateBubbleInfo());
+ NewBubble returnToCallBubble = NewBubbleComponent.get(context).getNewBubble();
+ returnToCallBubble.setBubbleInfo(generateBubbleInfo());
returnToCallBubble.show();
return returnToCallBubble;
}