• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     private static final String KEY_SKIP_IF_LOWER_VERSION =
49             "com.google.android.clockwork.EXTRA_SKIP_IF_LOWER_VERSION";
50 
getPackageName(Bundle b)51     public static String getPackageName(Bundle b) {
52         return b.getString(KEY_PACKAGE_NAME);
53     }
54 
setPackageName(Bundle b, String packageName)55     public static Bundle setPackageName(Bundle b, String packageName) {
56         b.putString(KEY_PACKAGE_NAME, packageName);
57         return b;
58     }
59 
getAssetUri(Bundle b)60     public static Uri getAssetUri(Bundle b) {
61         return b.getParcelable(KEY_ASSET_URI);
62     }
63 
getPermUri(Bundle b)64     public static Uri getPermUri(Bundle b) {
65         return b.getParcelable(KEY_PERM_URI);
66     }
67 
checkPerms(Bundle b)68     public static boolean checkPerms(Bundle b) {
69         return b.getBoolean(KEY_CHECK_PERMS);
70     }
71 
skipIfSameVersion(Bundle b)72     public static boolean skipIfSameVersion(Bundle b) {
73         return b.getBoolean(KEY_SKIP_IF_SAME_VERSION);
74     }
75 
getCompanionSdkVersion(Bundle b)76     public static int getCompanionSdkVersion(Bundle b) {
77         return b.getInt(KEY_COMPANION_SDK_VERSION);
78     }
79 
getCompanionDeviceVersion(Bundle b)80     public static int getCompanionDeviceVersion(Bundle b) {
81         return b.getInt(KEY_COMPANION_DEVICE_VERSION);
82     }
83 
getCompressionAlg(Bundle b)84     public static String getCompressionAlg(Bundle b) {
85         return b.getString(KEY_COMPRESSION_ALG);
86     }
87 
getStartId(Bundle b)88     public static int getStartId(Bundle b) {
89         return b.getInt(KEY_START_ID);
90     }
91 
skipIfLowerVersion(Bundle b)92     public static boolean skipIfLowerVersion(Bundle b) {
93         return b.getBoolean(KEY_SKIP_IF_LOWER_VERSION, false);
94     }
95 
setStartId(Bundle b, int startId)96     public static Bundle setStartId(Bundle b, int startId) {
97         b.putInt(KEY_START_ID, startId);
98         return b;
99     }
100 }
101