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.permissioncontroller.safetycenter.ui
18 
19 import android.os.Build
20 import android.os.Bundle
21 import androidx.annotation.RequiresApi
22 import androidx.fragment.app.Fragment
23 import com.android.permissioncontroller.R
24 import com.android.permissioncontroller.permission.utils.Utils
25 
26 @RequiresApi(Build.VERSION_CODES.TIRAMISU)
27 internal class SafetyCenterScrollWrapperFragment :
28     Fragment(
29         if (SafetyCenterUiFlags.getShowSubpages()) R.layout.safety_center_non_scroll_wrapper
30         else R.layout.safety_center_scroll_wrapper
31     ) {
32 
onCreatenull33     override fun onCreate(savedInstanceState: Bundle?) {
34         super.onCreate(savedInstanceState)
35 
36         if (savedInstanceState == null) {
37             childFragmentManager
38                 .beginTransaction()
39                 .add(
40                     R.id.fragment_container,
41                     SafetyCenterDashboardFragment.newInstance(
42                         Utils.getOrGenerateSessionId(requireActivity().getIntent()),
43                         /* isQuickSettingsFragment= */ false
44                     )
45                 )
46                 .commitNow()
47         }
48     }
49 }
50