From aa1f22f61ce5f0b1bdca898725956a081cf9ecb9 Mon Sep 17 00:00:00 2001 From: Evan Charlton Date: Fri, 5 Sep 2014 15:18:25 -0700 Subject: Send a broadcast when InCallUI is visible When InCallUI is visible, send a broadcast to let other apps know that InCallUI is ready, and that it is now safe to draw UI. Bug: 16988478 Change-Id: I1e9c3054e7c4f6d9809a4b13c3d1ff4516372143 --- .../src/com/android/incallui/InCallPresenter.java | 12 ++++++++++ .../com/android/incalluibind/ObjectFactory.java | 27 ++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 InCallUI/src/com/android/incalluibind/ObjectFactory.java diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java index d633f27c8..de09a8473 100644 --- a/InCallUI/src/com/android/incallui/InCallPresenter.java +++ b/InCallUI/src/com/android/incallui/InCallPresenter.java @@ -16,6 +16,7 @@ package com.android.incallui; +import android.Manifest; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; @@ -30,6 +31,8 @@ import android.view.View; import com.google.common.base.Preconditions; +import com.android.incalluibind.ObjectFactory; + import java.util.Collections; import java.util.List; import java.util.Locale; @@ -48,6 +51,9 @@ import java.util.concurrent.CopyOnWriteArrayList; */ public class InCallPresenter implements CallList.Listener, InCallPhoneListener { + private static final String EXTRA_FIRST_TIME_SHOWN = + "com.android.incallui.intent.extra.FIRST_TIME_SHOWN"; + private static InCallPresenter sInCallPresenter; /** @@ -598,6 +604,12 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener { } if (showing) { + Intent broadcastIntent = ObjectFactory.getUiReadyBroadcastIntent(); + if (broadcastIntent != null) { + broadcastIntent.putExtra(EXTRA_FIRST_TIME_SHOWN, !mIsActivityPreviouslyStarted); + mContext.sendBroadcast(broadcastIntent, Manifest.permission.READ_PHONE_STATE); + } + mIsActivityPreviouslyStarted = true; } } diff --git a/InCallUI/src/com/android/incalluibind/ObjectFactory.java b/InCallUI/src/com/android/incalluibind/ObjectFactory.java new file mode 100644 index 000000000..5813ce9e6 --- /dev/null +++ b/InCallUI/src/com/android/incalluibind/ObjectFactory.java @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2014 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. + */ + +package com.android.incalluibind; + +import android.content.Intent; + +public class ObjectFactory { + + /** @return An {@link Intent} to be broadcast when the InCallUI is visible. */ + public static Intent getUiReadyBroadcastIntent() { + return null; + } +} -- cgit v1.2.3