• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 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.car.settings.datausage;
18 
19 import android.car.drivingstate.CarUxRestrictions;
20 import android.content.Context;
21 import android.net.NetworkTemplate;
22 
23 import androidx.preference.Preference;
24 
25 import com.android.car.settings.common.FragmentController;
26 import com.android.car.settings.common.PreferenceController;
27 import com.android.settingslib.NetworkPolicyEditor;
28 
29 /**
30  * Defines the shared getters and setters used by {@link PreferenceController} implementations
31  * related to data usage warning and limit.
32  *
33  * @param <V> the upper bound on the type of {@link Preference} on which the controller
34  *            expects to operate.
35  */
36 public abstract class DataWarningAndLimitBasePreferenceController<V extends Preference> extends
37         PreferenceController<V> {
38 
39     private NetworkPolicyEditor mNetworkPolicyEditor;
40     private NetworkTemplate mNetworkTemplate;
41 
DataWarningAndLimitBasePreferenceController(Context context, String preferenceKey, FragmentController fragmentController, CarUxRestrictions uxRestrictions)42     public DataWarningAndLimitBasePreferenceController(Context context, String preferenceKey,
43             FragmentController fragmentController, CarUxRestrictions uxRestrictions) {
44         super(context, preferenceKey, fragmentController, uxRestrictions);
45     }
46 
47     /** Gets the {@link NetworkPolicyEditor}. */
getNetworkPolicyEditor()48     public NetworkPolicyEditor getNetworkPolicyEditor() {
49         return mNetworkPolicyEditor;
50     }
51 
52     /** Sets the {@link NetworkPolicyEditor}. */
setNetworkPolicyEditor(NetworkPolicyEditor networkPolicyEditor)53     public void setNetworkPolicyEditor(NetworkPolicyEditor networkPolicyEditor) {
54         mNetworkPolicyEditor = networkPolicyEditor;
55     }
56 
57     /** Gets the {@link NetworkTemplate}. */
getNetworkTemplate()58     public NetworkTemplate getNetworkTemplate() {
59         return mNetworkTemplate;
60     }
61 
62     /** Sets the {@link NetworkTemplate}. */
setNetworkTemplate(NetworkTemplate networkTemplate)63     public void setNetworkTemplate(NetworkTemplate networkTemplate) {
64         mNetworkTemplate = networkTemplate;
65     }
66 }
67