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

Commit c61a76fc authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Remove bubble from AOSP."

parents a50c9bd7 b6e16f57
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line 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.calllocation.stub.StubCallLocationModule;
import com.android.incallui.maps.stub.StubMapsModule;
import com.android.incallui.maps.stub.StubMapsModule;
import com.android.incallui.speakeasy.StubSpeakEasyModule;
import com.android.incallui.speakeasy.StubSpeakEasyModule;
import com.android.newbubble.stub.StubNewBubbleModule;
import com.android.voicemail.impl.VoicemailModule;
import com.android.voicemail.impl.VoicemailModule;
import dagger.Component;
import dagger.Component;
import javax.inject.Singleton;
import javax.inject.Singleton;
@@ -59,6 +60,7 @@ import javax.inject.Singleton;
    StubCallLocationModule.class,
    StubCallLocationModule.class,
    StubDuoModule.class,
    StubDuoModule.class,
    StubEnrichedCallModule.class,
    StubEnrichedCallModule.class,
    StubNewBubbleModule.class,
    StubFeedbackModule.class,
    StubFeedbackModule.class,
    StubMapsModule.class,
    StubMapsModule.class,
    StubSimSuggestionModule.class,
    StubSimSuggestionModule.class,
+2 −0
Original line number Original line 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.calllocation.CallLocationComponent;
import com.android.incallui.maps.MapsComponent;
import com.android.incallui.maps.MapsComponent;
import com.android.incallui.speakeasy.SpeakEasyComponent;
import com.android.incallui.speakeasy.SpeakEasyComponent;
import com.android.newbubble.NewBubbleComponent;
import com.android.voicemail.VoicemailComponent;
import com.android.voicemail.VoicemailComponent;


/**
/**
@@ -56,6 +57,7 @@ public interface BaseDialerRootComponent
        FeedbackComponent.HasComponent,
        FeedbackComponent.HasComponent,
        MainComponent.HasComponent,
        MainComponent.HasComponent,
        MapsComponent.HasComponent,
        MapsComponent.HasComponent,
        NewBubbleComponent.HasComponent,
        PhoneLookupComponent.HasComponent,
        PhoneLookupComponent.HasComponent,
        PhoneNumberGeoUtilComponent.HasComponent,
        PhoneNumberGeoUtilComponent.HasComponent,
        PreCallComponent.HasComponent,
        PreCallComponent.HasComponent,
+2 −0
Original line number Original line 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.calllocation.impl.CallLocationModule;
import com.android.incallui.maps.impl.MapsModule;
import com.android.incallui.maps.impl.MapsModule;
import com.android.incallui.speakeasy.StubSpeakEasyModule;
import com.android.incallui.speakeasy.StubSpeakEasyModule;
import com.android.newbubble.stub.StubNewBubbleModule;
import com.android.voicemail.impl.VoicemailModule;
import com.android.voicemail.impl.VoicemailModule;
import dagger.Component;
import dagger.Component;
import javax.inject.Singleton;
import javax.inject.Singleton;
@@ -64,6 +65,7 @@ import javax.inject.Singleton;
    StubDuoModule.class,
    StubDuoModule.class,
    StubEnrichedCallModule.class,
    StubEnrichedCallModule.class,
    StubFeedbackModule.class,
    StubFeedbackModule.class,
    StubNewBubbleModule.class,
    StubSimSuggestionModule.class,
    StubSimSuggestionModule.class,
    StubSpamModule.class,
    StubSpamModule.class,
    StubSpeakEasyModule.class,
    StubSpeakEasyModule.class,
+25 −2
Original line number Original line Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
import android.graphics.drawable.Icon;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.annotation.NonNull;
import android.support.annotation.VisibleForTesting;
import android.support.annotation.VisibleForTesting;
import android.telecom.CallAudioState;
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;
import com.android.incallui.speakerbuttonlogic.SpeakerButtonInfo.IconSize;
import com.android.incallui.speakerbuttonlogic.SpeakerButtonInfo.IconSize;
import com.android.newbubble.NewBubble;
import com.android.newbubble.NewBubble;
import com.android.newbubble.NewBubbleComponent;
import com.android.newbubble.NewBubbleInfo;
import com.android.newbubble.NewBubbleInfo;
import com.android.newbubble.NewBubbleInfo.Action;
import com.android.newbubble.NewBubbleInfo.Action;
import java.lang.ref.WeakReference;
import java.lang.ref.WeakReference;
@@ -58,6 +60,8 @@ public class NewReturnToCallController implements InCallUiListener, Listener, Au
  @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
  @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
  NewBubble bubble;
  NewBubble bubble;


  private static Boolean canShowBubblesForTesting = null;

  private CallAudioState audioState;
  private CallAudioState audioState;


  private final PendingIntent toggleSpeaker;
  private final PendingIntent toggleSpeaker;
@@ -132,13 +136,32 @@ public class NewReturnToCallController implements InCallUiListener, Listener, Au
    startContactInfoSearch();
    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
  @VisibleForTesting
  public NewBubble startBubble() {
  public NewBubble startBubble() {
    if (!NewBubble.canShowBubbles(context)) {
    if (!canShowBubbles(context)) {
      LogUtil.i("ReturnToCallController.startNewBubble", "can't show bubble, no permission");
      LogUtil.i("ReturnToCallController.startNewBubble", "can't show bubble, no permission");
      return null;
      return null;
    }
    }
    NewBubble returnToCallBubble = NewBubble.createBubble(context, generateBubbleInfo());
    NewBubble returnToCallBubble = NewBubbleComponent.get(context).getNewBubble();
    returnToCallBubble.setBubbleInfo(generateBubbleInfo());
    returnToCallBubble.show();
    returnToCallBubble.show();
    return returnToCallBubble;
    return returnToCallBubble;
  }
  }
+0 −22
Original line number Original line 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