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 com.android.settings.remoteauth 18 19 import android.os.Bundle 20 21 import androidx.annotation.IdRes 22 import androidx.navigation.fragment.NavHostFragment 23 24 import com.android.settings.R 25 import com.android.settings.SetupWizardUtils 26 import com.android.settings.core.InstrumentedActivity 27 import com.google.android.setupdesign.util.ThemeHelper 28 29 open class RemoteAuthActivity : InstrumentedActivity() { onCreatenull30 override fun onCreate(savedInstanceState: Bundle?) { 31 super.onCreate(savedInstanceState) 32 setTheme(SetupWizardUtils.getTheme(this, getIntent())) 33 ThemeHelper.trySetDynamicColor(this) 34 setContentView(R.layout.remote_auth_root) 35 // TODO(b/290768873): Change to remote_auth_enroll_introduction_fragment if no device is 36 // enrolled. 37 initializeNavigation(R.id.remote_auth_settings_fragment) 38 } 39 getMetricsCategorynull40 override fun getMetricsCategory(): Int { 41 // TODO() Update frameworks/proto_logging/stats/enums/app/settings_enums.proto 42 return 0 43 } 44 initializeNavigationnull45 private fun initializeNavigation(@IdRes startDestinationId: Int) { 46 val navHostFragment = 47 supportFragmentManager.findFragmentById(R.id.nav_host_fragment) as NavHostFragment 48 val navController = navHostFragment.navController 49 val navGraph = navController.navInflater.inflate(R.navigation.remote_auth_navigation) 50 navGraph.setStartDestination(startDestinationId) 51 navController.graph = navGraph 52 } 53 }