dcashman | 9d2f441 | 2014-06-09 09:27:54 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 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 com.android.server.pm; |
| 18 | |
| 19 | import android.os.Binder; |
| 20 | |
dcashman | 8c04fac | 2015-03-23 11:39:42 -0700 | [diff] [blame] | 21 | class KeySetHandle extends Binder{ |
| 22 | private final long mId; |
| 23 | private int mRefCount; |
| 24 | |
| 25 | protected KeySetHandle(long id) { |
| 26 | mId = id; |
| 27 | mRefCount = 1; |
| 28 | } |
| 29 | |
| 30 | /* |
| 31 | * Only used when reading state from packages.xml |
| 32 | */ |
| 33 | protected KeySetHandle(long id, int refCount) { |
| 34 | mId = id; |
| 35 | mRefCount = refCount; |
| 36 | } |
| 37 | |
| 38 | public long getId() { |
| 39 | return mId; |
| 40 | } |
| 41 | |
| 42 | protected int getRefCountLPr() { |
| 43 | return mRefCount; |
| 44 | } |
| 45 | |
| 46 | /* |
| 47 | * Only used when reading state from packages.xml |
| 48 | */ |
| 49 | protected void setRefCountLPw(int newCount) { |
| 50 | mRefCount = newCount; |
| 51 | return; |
| 52 | } |
| 53 | |
| 54 | protected void incrRefCountLPw() { |
| 55 | mRefCount++; |
| 56 | return; |
| 57 | } |
| 58 | |
| 59 | protected int decrRefCountLPw() { |
| 60 | mRefCount--; |
| 61 | return mRefCount; |
| 62 | } |
| 63 | } |