1 /*
2  * Copyright (C) 2022 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.settings.biometrics.face;
18 
19 import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
20 
21 import android.content.Intent;
22 import android.os.Bundle;
23 
24 import androidx.fragment.app.FragmentActivity;
25 
26 /**
27  * Wrapper of {@link FaceEnrollIntroduction} to use with a pre-defined task affinity.
28  *
29  * <p>Trampolines over to FaceEnrollIntroduction - doing this as a trampoline rather than having
30  * this activity extend FaceEnrollIntroduction works around b/331157120.
31  */
32 public class FaceEnrollIntroductionInternal extends FragmentActivity {
33     @Override
onCreate(Bundle savedInstanceState)34     protected void onCreate(Bundle savedInstanceState) {
35         super.onCreate(savedInstanceState);
36         if (isFinishing()) {
37             return;
38         }
39 
40         // Copy our intent to grab all extras. Drop flags so we don't start new tasks twice.
41         Intent trampoline = new Intent(getIntent());
42         trampoline.setFlags(0);
43 
44         // Trampoline to the intended activity, and finish
45         trampoline.setClassName(SETTINGS_PACKAGE_NAME, FaceEnrollIntroduction.class.getName());
46         startActivity(trampoline);
47         finish();
48     }
49 }
50