• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 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 package com.android.settings.accessibility;
17 
18 import android.app.settings.SettingsEnums;
19 import android.media.AudioAttributes;
20 import android.os.Vibrator;
21 import android.provider.Settings;
22 
23 import com.android.settings.R;
24 
25 /**
26  * Fragment for picking accessibility shortcut service
27  */
28 public class NotificationVibrationPreferenceFragment extends VibrationPreferenceFragment {
29     @Override
getMetricsCategory()30     public int getMetricsCategory() {
31         return SettingsEnums.ACCESSIBILITY_VIBRATION_NOTIFICATION;
32     }
33 
34     @Override
getPreferenceScreenResId()35     protected int getPreferenceScreenResId() {
36         return R.xml.accessibility_notification_vibration_settings;
37     }
38 
39     /**
40      * Get the setting string of the vibration intensity setting this preference is dealing with.
41      */
42     @Override
getVibrationIntensitySetting()43     protected String getVibrationIntensitySetting() {
44         return Settings.System.NOTIFICATION_VIBRATION_INTENSITY;
45     }
46 
47     @Override
getVibrationEnabledSetting()48     protected String getVibrationEnabledSetting() {
49         return "";
50     }
51 
52     @Override
getPreviewVibrationAudioAttributesUsage()53     protected int getPreviewVibrationAudioAttributesUsage() {
54         return AudioAttributes.USAGE_NOTIFICATION;
55     }
56 
57     @Override
getDefaultVibrationIntensity()58     protected int getDefaultVibrationIntensity() {
59         Vibrator vibrator = getContext().getSystemService(Vibrator.class);
60         return vibrator.getDefaultNotificationVibrationIntensity();
61     }
62 }
63