Kenny Root | cf0b38c | 2011-03-22 14:17:59 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2006 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.content.pm.PackageParser; |
| 20 | import android.content.pm.PermissionInfo; |
| 21 | |
| 22 | final class BasePermission { |
| 23 | final static int TYPE_NORMAL = 0; |
| 24 | |
| 25 | final static int TYPE_BUILTIN = 1; |
| 26 | |
| 27 | final static int TYPE_DYNAMIC = 2; |
| 28 | |
| 29 | final String name; |
| 30 | |
| 31 | String sourcePackage; |
| 32 | |
| 33 | PackageSettingBase packageSetting; |
| 34 | |
| 35 | final int type; |
| 36 | |
| 37 | int protectionLevel; |
| 38 | |
| 39 | PackageParser.Permission perm; |
| 40 | |
| 41 | PermissionInfo pendingInfo; |
| 42 | |
| 43 | int uid; |
| 44 | |
| 45 | int[] gids; |
| 46 | |
| 47 | BasePermission(String _name, String _sourcePackage, int _type) { |
| 48 | name = _name; |
| 49 | sourcePackage = _sourcePackage; |
| 50 | type = _type; |
| 51 | // Default to most conservative protection level. |
| 52 | protectionLevel = PermissionInfo.PROTECTION_SIGNATURE; |
| 53 | } |
| 54 | |
| 55 | public String toString() { |
| 56 | return "BasePermission{" + Integer.toHexString(System.identityHashCode(this)) + " " + name |
| 57 | + "}"; |
| 58 | } |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame^] | 59 | |
| 60 | public boolean isRuntime() { |
| 61 | return (protectionLevel & PermissionInfo.PROTECTION_MASK_BASE) |
| 62 | == PermissionInfo.PROTECTION_DANGEROUS; |
| 63 | } |
Kenny Root | cf0b38c | 2011-03-22 14:17:59 -0700 | [diff] [blame] | 64 | } |