• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 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.packageinstaller.permission.ui.handheld;
18 
19 import static com.android.packageinstaller.Constants.EXTRA_SESSION_ID;
20 
21 import android.os.Bundle;
22 import android.view.MenuItem;
23 
24 /**
25  * Fragment that allows the user to manage custom permissions.
26  */
27 public class ManageCustomPermissionsFragment extends ManagePermissionsFragment {
28 
29     /**
30      * @return A new fragment
31      */
newInstance(long sessionId)32     public static ManageCustomPermissionsFragment newInstance(long sessionId) {
33         ManageCustomPermissionsFragment fragment = new ManageCustomPermissionsFragment();
34         Bundle arguments = new Bundle();
35         arguments.putLong(EXTRA_SESSION_ID, sessionId);
36         fragment.setArguments(arguments);
37         return fragment;
38     }
39 
40     @Override
onStart()41     public void onStart() {
42         super.onStart();
43 
44         getActivity().setTitle(com.android.permissioncontroller.R.string.additional_permissions);
45     }
46 
47     @Override
onOptionsItemSelected(MenuItem item)48     public boolean onOptionsItemSelected(MenuItem item) {
49         switch (item.getItemId()) {
50             case android.R.id.home:
51                 getFragmentManager().popBackStack();
52                 return true;
53         }
54         return super.onOptionsItemSelected(item);
55     }
56 
57     @Override
updatePermissionsUi()58     protected void updatePermissionsUi() {
59         updatePermissionsUi(false);
60     }
61 }
62