1 /*
2  * Copyright (C) 2021 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.permission.ui.handheld.v31;
18 
19 import static com.android.permissioncontroller.Constants.EXTRA_SESSION_ID;
20 
21 import android.content.Intent;
22 import android.os.Build;
23 import android.os.Bundle;
24 
25 import androidx.annotation.NonNull;
26 import androidx.annotation.RequiresApi;
27 import androidx.preference.PreferenceFragmentCompat;
28 
29 import com.android.permissioncontroller.permission.ui.handheld.PermissionsCollapsingToolbarBaseFragment;
30 
31 /** Wrapper over PermissionUsageFragment */
32 @RequiresApi(Build.VERSION_CODES.S)
33 public class PermissionUsageWrapperFragment extends PermissionsCollapsingToolbarBaseFragment {
34     @NonNull
35     @Override
createPreferenceFragment()36     public PreferenceFragmentCompat createPreferenceFragment() {
37         return new PermissionUsageFragment();
38     }
39 
40     /**
41      * @return A new fragment
42      */
newInstance( long numMillis, long sessionId)43     public static @NonNull PermissionUsageWrapperFragment newInstance(
44             long numMillis, long sessionId) {
45         PermissionUsageWrapperFragment fragment = new PermissionUsageWrapperFragment();
46         Bundle arguments = new Bundle();
47         arguments.putLong(Intent.EXTRA_DURATION_MILLIS, numMillis);
48         arguments.putLong(EXTRA_SESSION_ID, sessionId);
49         fragment.setArguments(arguments);
50         return fragment;
51     }
52 }
53