Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b6e16f57 authored by yueg's avatar yueg Committed by Copybara-Service
Browse files

Remove bubble from AOSP.

Bug: 67605985
Test: NewBubbleImplTest, NewBubbleImplIntegrationTest, NewReturnToCallControllerTest
PiperOrigin-RevId: 184026033
Change-Id: Ie141ce9a0265ce3a08c01943cdeb94e2cd962e9f
parent a50c9bd7
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import com.android.dialer.strictmode.impl.SystemStrictModeModule;
import com.android.incallui.calllocation.stub.StubCallLocationModule;
import com.android.incallui.maps.stub.StubMapsModule;
import com.android.incallui.speakeasy.StubSpeakEasyModule;
import com.android.newbubble.stub.StubNewBubbleModule;
import com.android.voicemail.impl.VoicemailModule;
import dagger.Component;
import javax.inject.Singleton;
@@ -59,6 +60,7 @@ import javax.inject.Singleton;
    StubCallLocationModule.class,
    StubDuoModule.class,
    StubEnrichedCallModule.class,
    StubNewBubbleModule.class,
    StubFeedbackModule.class,
    StubMapsModule.class,
    StubSimSuggestionModule.class,
+2 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import com.android.dialer.strictmode.StrictModeComponent;
import com.android.incallui.calllocation.CallLocationComponent;
import com.android.incallui.maps.MapsComponent;
import com.android.incallui.speakeasy.SpeakEasyComponent;
import com.android.newbubble.NewBubbleComponent;
import com.android.voicemail.VoicemailComponent;

/**
@@ -56,6 +57,7 @@ public interface BaseDialerRootComponent
        FeedbackComponent.HasComponent,
        MainComponent.HasComponent,
        MapsComponent.HasComponent,
        NewBubbleComponent.HasComponent,
        PhoneLookupComponent.HasComponent,
        PhoneNumberGeoUtilComponent.HasComponent,
        PreCallComponent.HasComponent,
+2 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import com.android.dialer.strictmode.impl.SystemStrictModeModule;
import com.android.incallui.calllocation.impl.CallLocationModule;
import com.android.incallui.maps.impl.MapsModule;
import com.android.incallui.speakeasy.StubSpeakEasyModule;
import com.android.newbubble.stub.StubNewBubbleModule;
import com.android.voicemail.impl.VoicemailModule;
import dagger.Component;
import javax.inject.Singleton;
@@ -64,6 +65,7 @@ import javax.inject.Singleton;
    StubDuoModule.class,
    StubEnrichedCallModule.class,
    StubFeedbackModule.class,
    StubNewBubbleModule.class,
    StubSimSuggestionModule.class,
    StubSpamModule.class,
    StubSpeakEasyModule.class,
+25 −2
Original line number Diff line number Diff line
@@ -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;
  }
+0 −22
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2017 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
  -->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.android.newbubble">

  <uses-sdk android:minSdkVersion="23"/>
  <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
</manifest>
Loading