1 /* 2 * Copyright (C) 2018 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.permissioncontroller.role.ui; 18 19 import android.os.Bundle; 20 21 import androidx.annotation.Nullable; 22 import androidx.fragment.app.Fragment; 23 24 import com.android.permissioncontroller.DeviceUtils; 25 import com.android.permissioncontroller.R; 26 import com.android.permissioncontroller.role.ui.auto.AutoDefaultAppListFragment; 27 import com.android.permissioncontroller.role.ui.handheld.HandheldDefaultAppListFragment; 28 29 /** 30 * Activity for the list of default apps. 31 */ 32 public class DefaultAppListActivity extends SettingsActivity { 33 34 @Override onCreate(@ullable Bundle savedInstanceState)35 protected void onCreate(@Nullable Bundle savedInstanceState) { 36 if (DeviceUtils.isAuto(this)) { 37 // Automotive relies on a different theme. Apply before calling super so that 38 // fragments are restored properly on configuration changes. 39 setTheme(R.style.CarSettings); 40 } 41 42 super.onCreate(savedInstanceState); 43 44 if (savedInstanceState == null) { 45 Fragment fragment; 46 if (DeviceUtils.isAuto(this)) { 47 fragment = AutoDefaultAppListFragment.newInstance(); 48 } else { 49 fragment = HandheldDefaultAppListFragment.newInstance(); 50 } 51 getSupportFragmentManager().beginTransaction() 52 .add(android.R.id.content, fragment) 53 .commit(); 54 } 55 } 56 } 57