• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 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 android.app.cts;
18 
19 import static android.content.pm.PackageManager.MATCH_DEFAULT_ONLY;
20 
21 import static org.junit.Assert.assertNotNull;
22 import static org.junit.Assume.assumeFalse;
23 
24 import android.content.Context;
25 import android.content.Intent;
26 import android.content.pm.PackageManager;
27 import android.content.pm.ResolveInfo;
28 import android.net.Uri;
29 import android.provider.Settings;
30 
31 import androidx.test.ext.junit.runners.AndroidJUnit4;
32 import androidx.test.platform.app.InstrumentationRegistry;
33 
34 import org.junit.Test;
35 import org.junit.runner.RunWith;
36 
37 @RunWith(AndroidJUnit4.class)
38 public class ManageFsiTest {
39 
40     private static final String STUB_PACKAGE_NAME = "android.app.stubs";
41 
42     @Test
testManageAppUseFsiIntent_ResolvesToActivity()43     public void testManageAppUseFsiIntent_ResolvesToActivity() {
44         final Context context = InstrumentationRegistry.getInstrumentation().getContext();
45         final PackageManager pm = context.getPackageManager();
46         assumeFalse("TV does not support fullscreen intents",
47                 pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK));
48 
49         final Intent intent = new Intent(Settings.ACTION_MANAGE_APP_USE_FULL_SCREEN_INTENT);
50         intent.setData(Uri.parse("package:" + STUB_PACKAGE_NAME));
51         final ResolveInfo resolveInfo = pm.resolveActivity(intent, MATCH_DEFAULT_ONLY);
52         assertNotNull(resolveInfo);
53     }
54 }
55