1 /* 2 * Copyright (C) 2015 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.packageinstaller.wear; 18 19 import android.content.Intent; 20 import android.net.Uri; 21 import android.os.Bundle; 22 23 /** 24 * Installation Util that contains a list of parameters that are needed for 25 * installing/uninstalling. 26 */ 27 public class WearPackageArgs { 28 private static final String KEY_PACKAGE_NAME = 29 "com.google.android.clockwork.EXTRA_PACKAGE_NAME"; 30 private static final String KEY_ASSET_URI = 31 "com.google.android.clockwork.EXTRA_ASSET_URI"; 32 private static final String KEY_START_ID = 33 "com.google.android.clockwork.EXTRA_START_ID"; 34 private static final String KEY_PERM_URI = 35 "com.google.android.clockwork.EXTRA_PERM_URI"; 36 private static final String KEY_CHECK_PERMS = 37 "com.google.android.clockwork.EXTRA_CHECK_PERMS"; 38 private static final String KEY_SKIP_IF_SAME_VERSION = 39 "com.google.android.clockwork.EXTRA_SKIP_IF_SAME_VERSION"; 40 private static final String KEY_COMPRESSION_ALG = 41 "com.google.android.clockwork.EXTRA_KEY_COMPRESSION_ALG"; 42 private static final String KEY_COMPANION_SDK_VERSION = 43 "com.google.android.clockwork.EXTRA_KEY_COMPANION_SDK_VERSION"; 44 private static final String KEY_COMPANION_DEVICE_VERSION = 45 "com.google.android.clockwork.EXTRA_KEY_COMPANION_DEVICE_VERSION"; 46 private static final String KEY_SHOULD_CHECK_GMS_DEPENDENCY = 47 "com.google.android.clockwork.EXTRA_KEY_SHOULD_CHECK_GMS_DEPENDENCY"; 48 49 public static String getPackageName(Bundle b) { 50 return b.getString(KEY_PACKAGE_NAME); 51 } 52 53 public static Bundle setPackageName(Bundle b, String packageName) { 54 b.putString(KEY_PACKAGE_NAME, packageName); 55 return b; 56 } 57 58 public static Uri getAssetUri(Bundle b) { 59 return b.getParcelable(KEY_ASSET_URI); 60 } 61 62 public static Uri getPermUri(Bundle b) { 63 return b.getParcelable(KEY_PERM_URI); 64 } 65 66 public static boolean checkPerms(Bundle b) { 67 return b.getBoolean(KEY_CHECK_PERMS); 68 } 69 70 public static boolean skipIfSameVersion(Bundle b) { 71 return b.getBoolean(KEY_SKIP_IF_SAME_VERSION); 72 } 73 74 public static int getCompanionSdkVersion(Bundle b) { 75 return b.getInt(KEY_COMPANION_SDK_VERSION); 76 } 77 78 public static int getCompanionDeviceVersion(Bundle b) { 79 return b.getInt(KEY_COMPANION_DEVICE_VERSION); 80 } 81 82 public static String getCompressionAlg(Bundle b) { 83 return b.getString(KEY_COMPRESSION_ALG); 84 } 85 86 public static int getStartId(Bundle b) { 87 return b.getInt(KEY_START_ID); 88 } 89 90 public static Bundle setStartId(Bundle b, int startId) { 91 b.putInt(KEY_START_ID, startId); 92 return b; 93 } 94 } 95