• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License
15  */
16 
17 package com.android.dialer.precall.impl;
18 
19 import android.annotation.TargetApi;
20 import android.app.Activity;
21 import android.app.KeyguardManager;
22 import android.os.Build.VERSION;
23 import android.os.Build.VERSION_CODES;
24 import android.os.Bundle;
25 import android.support.annotation.Nullable;
26 import android.view.WindowManager.LayoutParams;
27 
28 /** A transparent activity to host dialogs for {@link PreCallCoordinatorImpl} */
29 public class PreCallActivity extends Activity {
30 
31   private PreCallCoordinatorImpl preCallCoordinator;
32 
33   @Override
onCreate(@ullable Bundle savedInstanceState)34   public void onCreate(@Nullable Bundle savedInstanceState) {
35     super.onCreate(savedInstanceState);
36     preCallCoordinator = new PreCallCoordinatorImpl(this);
37     preCallCoordinator.onCreate(getIntent(), savedInstanceState);
38     if (getSystemService(KeyguardManager.class).isKeyguardLocked()) {
39         getWindow().addFlags(LayoutParams.FLAG_SHOW_WHEN_LOCKED);
40 
41     }
42   }
43 
44   @Override
onRestoreInstanceState(Bundle savedInstanceState)45   protected void onRestoreInstanceState(Bundle savedInstanceState) {
46     super.onRestoreInstanceState(savedInstanceState);
47     preCallCoordinator.onRestoreInstanceState(savedInstanceState);
48   }
49 
50   @Override
onResume()51   public void onResume() {
52     super.onResume();
53     preCallCoordinator.onResume();
54   }
55 
56   @Override
onPause()57   public void onPause() {
58     super.onPause();
59     preCallCoordinator.onPause();
60   }
61 
62   @Override
onSaveInstanceState(Bundle outState)63   public void onSaveInstanceState(Bundle outState) {
64     super.onSaveInstanceState(outState);
65     preCallCoordinator.onSaveInstanceState(outState);
66   }
67 }
68