1 /* 2 * Copyright (C) 2014 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.media; 18 19 import android.compat.annotation.UnsupportedAppUsage; 20 import android.os.Build; 21 22 /** 23 * The AudioHandle is used by the audio framework implementation to 24 * uniquely identify a particular component of the routing topology 25 * (AudioPort or AudioPatch) 26 * It is not visible or used at the API. 27 */ 28 class AudioHandle { 29 @UnsupportedAppUsage 30 private final int mId; 31 32 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) AudioHandle(int id)33 AudioHandle(int id) { 34 mId = id; 35 } 36 id()37 int id() { 38 return mId; 39 } 40 41 @Override equals(Object o)42 public boolean equals(Object o) { 43 if (o == null || !(o instanceof AudioHandle)) { 44 return false; 45 } 46 AudioHandle ah = (AudioHandle)o; 47 return mId == ah.id(); 48 } 49 50 @Override hashCode()51 public int hashCode() { 52 return mId; 53 } 54 55 @Override toString()56 public String toString() { 57 return Integer.toString(mId); 58 } 59 } 60