1 /* 2 * Copyright (C) 2023 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 android.os; 18 19 public class NullVibratorManager extends VibratorManager { 20 private static final NullVibratorManager sInstance = new NullVibratorManager(); 21 getInstance()22 public static NullVibratorManager getInstance() { 23 return sInstance; 24 } 25 NullVibratorManager()26 private NullVibratorManager() { } 27 28 @Override getVibratorIds()29 public int[] getVibratorIds() { 30 return new int[0]; 31 } 32 33 @Override getVibrator(int vibratorId)34 public Vibrator getVibrator(int vibratorId) { 35 return NullVibrator.getInstance(); 36 } 37 38 @Override getDefaultVibrator()39 public Vibrator getDefaultVibrator() { 40 return NullVibrator.getInstance(); 41 } 42 43 @Override vibrate(int uid, String opPkg, CombinedVibration effect, String reason, VibrationAttributes attributes)44 public void vibrate(int uid, String opPkg, CombinedVibration effect, String reason, 45 VibrationAttributes attributes) { } 46 47 @Override cancel()48 public void cancel() { } 49 50 @Override cancel(int usageFilter)51 public void cancel(int usageFilter) { } 52 } 53