summaryrefslogtreecommitdiff
path: root/java/com/android/incallui/answer/impl/SmsBottomSheetFragment.java
diff options
context:
space:
mode:
authortwyen <twyen@google.com>2017-10-06 16:35:54 -0700
committerEric Erfanian <erfanian@google.com>2017-10-09 08:41:07 -0700
commit8efb49584f732014076390093ad90e23dce2e3ba (patch)
tree109b16036e6ca27d5fe8d1fb3bc4373ed64cdb03 /java/com/android/incallui/answer/impl/SmsBottomSheetFragment.java
parent30842b209934a98a0220673e2ab6b4bf500c15d3 (diff)
Implement InCallUiLock
When any locks are acquired, the InCallActivity will not auto-finish when there are no active calls. The disconnected cause and reject with SMS dialogs are migrated to use this API, which prevents the activity form ending before the user has finished interacting with the dialogs. Bug: 64215256 Test: InCallPresenterTest PiperOrigin-RevId: 171362338 Change-Id: Ied07ebbf6bee056ea6b2314c57f3324561b1651a
Diffstat (limited to 'java/com/android/incallui/answer/impl/SmsBottomSheetFragment.java')
-rw-r--r--java/com/android/incallui/answer/impl/SmsBottomSheetFragment.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/java/com/android/incallui/answer/impl/SmsBottomSheetFragment.java b/java/com/android/incallui/answer/impl/SmsBottomSheetFragment.java
index 085430ea2..6742e4a36 100644
--- a/java/com/android/incallui/answer/impl/SmsBottomSheetFragment.java
+++ b/java/com/android/incallui/answer/impl/SmsBottomSheetFragment.java
@@ -36,6 +36,7 @@ import android.widget.TextView;
import com.android.dialer.common.DpUtil;
import com.android.dialer.common.FragmentUtils;
import com.android.dialer.common.LogUtil;
+import com.android.incallui.incalluilock.InCallUiLock;
import java.util.ArrayList;
import java.util.List;
@@ -44,6 +45,8 @@ public class SmsBottomSheetFragment extends BottomSheetDialogFragment {
private static final String ARG_OPTIONS = "options";
+ private InCallUiLock inCallUiLock;
+
public static SmsBottomSheetFragment newInstance(@Nullable ArrayList<CharSequence> options) {
SmsBottomSheetFragment fragment = new SmsBottomSheetFragment();
Bundle args = new Bundle();
@@ -80,6 +83,10 @@ public class SmsBottomSheetFragment extends BottomSheetDialogFragment {
LogUtil.i("SmsBottomSheetFragment.onCreateDialog", null);
Dialog dialog = super.onCreateDialog(savedInstanceState);
dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
+
+ inCallUiLock =
+ FragmentUtils.getParentUnsafe(SmsBottomSheetFragment.this, SmsSheetHolder.class)
+ .acquireInCallUiLock("SmsBottomSheetFragment");
return dialog;
}
@@ -88,7 +95,7 @@ public class SmsBottomSheetFragment extends BottomSheetDialogFragment {
Context context = new ContextThemeWrapper(getContext(), getTheme());
TypedArray typedArray = context.obtainStyledAttributes(attrs);
Drawable background = typedArray.getDrawable(0);
- //noinspection ResourceType
+ // noinspection ResourceType
typedArray.recycle();
TextView textView = new TextView(context);
@@ -124,11 +131,14 @@ public class SmsBottomSheetFragment extends BottomSheetDialogFragment {
public void onDismiss(DialogInterface dialogInterface) {
super.onDismiss(dialogInterface);
FragmentUtils.getParentUnsafe(this, SmsSheetHolder.class).smsDismissed();
+ inCallUiLock.release();
}
/** Callback interface for {@link SmsBottomSheetFragment} */
public interface SmsSheetHolder {
+ InCallUiLock acquireInCallUiLock(String tag);
+
void smsSelected(@Nullable CharSequence text);
void smsDismissed();