1a198a29250acb7c3e918f1566727190966bb336fEric Laurent/* 2a198a29250acb7c3e918f1566727190966bb336fEric Laurent * Copyright (C) 2014 The Android Open Source Project 3a198a29250acb7c3e918f1566727190966bb336fEric Laurent * 4a198a29250acb7c3e918f1566727190966bb336fEric Laurent * Licensed under the Apache License, Version 2.0 (the "License"); 5a198a29250acb7c3e918f1566727190966bb336fEric Laurent * you may not use this file except in compliance with the License. 6a198a29250acb7c3e918f1566727190966bb336fEric Laurent * You may obtain a copy of the License at 7a198a29250acb7c3e918f1566727190966bb336fEric Laurent * 8a198a29250acb7c3e918f1566727190966bb336fEric Laurent * http://www.apache.org/licenses/LICENSE-2.0 9a198a29250acb7c3e918f1566727190966bb336fEric Laurent * 10a198a29250acb7c3e918f1566727190966bb336fEric Laurent * Unless required by applicable law or agreed to in writing, software 11a198a29250acb7c3e918f1566727190966bb336fEric Laurent * distributed under the License is distributed on an "AS IS" BASIS, 12a198a29250acb7c3e918f1566727190966bb336fEric Laurent * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13a198a29250acb7c3e918f1566727190966bb336fEric Laurent * See the License for the specific language governing permissions and 14a198a29250acb7c3e918f1566727190966bb336fEric Laurent * limitations under the License. 15a198a29250acb7c3e918f1566727190966bb336fEric Laurent */ 16a198a29250acb7c3e918f1566727190966bb336fEric Laurent 17a198a29250acb7c3e918f1566727190966bb336fEric Laurentpackage android.media; 18a198a29250acb7c3e918f1566727190966bb336fEric Laurent 19a198a29250acb7c3e918f1566727190966bb336fEric Laurent/** 20a198a29250acb7c3e918f1566727190966bb336fEric Laurent * The AudioHandle is used by the audio framework implementation to 21a198a29250acb7c3e918f1566727190966bb336fEric Laurent * uniquely identify a particular component of the routing topology 22a198a29250acb7c3e918f1566727190966bb336fEric Laurent * (AudioPort or AudioPatch) 23a198a29250acb7c3e918f1566727190966bb336fEric Laurent * It is not visible or used at the API. 24a198a29250acb7c3e918f1566727190966bb336fEric Laurent */ 25a198a29250acb7c3e918f1566727190966bb336fEric Laurentclass AudioHandle { 26a198a29250acb7c3e918f1566727190966bb336fEric Laurent private final int mId; 27a198a29250acb7c3e918f1566727190966bb336fEric Laurent 28a198a29250acb7c3e918f1566727190966bb336fEric Laurent AudioHandle(int id) { 29a198a29250acb7c3e918f1566727190966bb336fEric Laurent mId = id; 30a198a29250acb7c3e918f1566727190966bb336fEric Laurent } 31a198a29250acb7c3e918f1566727190966bb336fEric Laurent 32a198a29250acb7c3e918f1566727190966bb336fEric Laurent int id() { 33a198a29250acb7c3e918f1566727190966bb336fEric Laurent return mId; 34a198a29250acb7c3e918f1566727190966bb336fEric Laurent } 35a198a29250acb7c3e918f1566727190966bb336fEric Laurent 36a198a29250acb7c3e918f1566727190966bb336fEric Laurent @Override 37a198a29250acb7c3e918f1566727190966bb336fEric Laurent public boolean equals(Object o) { 38a198a29250acb7c3e918f1566727190966bb336fEric Laurent if (o == null || !(o instanceof AudioHandle)) { 39a198a29250acb7c3e918f1566727190966bb336fEric Laurent return false; 40a198a29250acb7c3e918f1566727190966bb336fEric Laurent } 41a198a29250acb7c3e918f1566727190966bb336fEric Laurent AudioHandle ah = (AudioHandle)o; 42a198a29250acb7c3e918f1566727190966bb336fEric Laurent return mId == ah.id(); 43a198a29250acb7c3e918f1566727190966bb336fEric Laurent } 44a198a29250acb7c3e918f1566727190966bb336fEric Laurent 45a198a29250acb7c3e918f1566727190966bb336fEric Laurent @Override 46a198a29250acb7c3e918f1566727190966bb336fEric Laurent public int hashCode() { 47a198a29250acb7c3e918f1566727190966bb336fEric Laurent return mId; 48a198a29250acb7c3e918f1566727190966bb336fEric Laurent } 492754fd0cd3f055b1d5f7f2ea1470b4d84011b379Mike Lockwood 502754fd0cd3f055b1d5f7f2ea1470b4d84011b379Mike Lockwood @Override 512754fd0cd3f055b1d5f7f2ea1470b4d84011b379Mike Lockwood public String toString() { 522754fd0cd3f055b1d5f7f2ea1470b4d84011b379Mike Lockwood return Integer.toString(mId); 532754fd0cd3f055b1d5f7f2ea1470b4d84011b379Mike Lockwood } 54a198a29250acb7c3e918f1566727190966bb336fEric Laurent} 55