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.tv.settings.startup;
18 
19 import android.app.Activity;
20 
21 import androidx.annotation.NonNull;
22 
23 /** Feature provider for TvSettings startup verification. */
24 public interface StartupVerificationFeatureProvider {
25 
26     /**
27      * Start the Activity for TvSettings startup verification.
28      *
29      * The Activity is expected to :
30      * - invoke setResult(RESULT_OK) and finish() immediately without showing any UI if TvSettings
31      * should be launched directly (e.g., device in adult profile or has gone through successful
32      * adult re-auth within 30s);
33      * - show challenge/informative UI (e.g., adult re-auth) based on device's status and invoke
34      * setResult(RESULT_OK) before finishing ONLY IF it has determined that TvSettings should be
35      * launched normally.
36      *
37      * @param activity    the activity to invoke startActivityForResult() from
38      * @param requestCode the requestCode expected by onActivityResult() to receive result of
39      *                    startup verification activity
40      * @return whether the Activity is found and started. The false result, aka the absence of the
41      * Activity handling the specified Intent is suggesting the missing of features that require the
42      * startup verification, in which case TvSettings should be started normally.
43      */
startStartupVerificationActivityForResult(@onNull Activity activity, int requestCode)44     boolean startStartupVerificationActivityForResult(@NonNull Activity activity, int requestCode);
45 }
46