summaryrefslogtreecommitdiffstats
path: root/src/com/android/packageinstaller/wear/WearPackageArgs.java
blob: 67051da0b93936d3d6aeebae490e153a144bf2ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
 * Copyright (C) 2015 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License
 */

package com.android.packageinstaller.wear;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;

/**
 * Installation Util that contains a list of parameters that are needed for
 * installing/uninstalling.
 */
public class WearPackageArgs {
    private static final String KEY_ASSET_URI =
            "com.google.android.clockwork.EXTRA_ASSET_URI";
    private static final String KEY_START_ID =
            "com.google.android.clockwork.EXTRA_START_ID";
    private static final String KEY_PERM_URI =
            "com.google.android.clockwork.EXTRA_PERM_URI";
    private static final String KEY_CHECK_PERMS =
            "com.google.android.clockwork.EXTRA_CHECK_PERMS";
    private static final String KEY_SKIP_IF_SAME_VERSION =
            "com.google.android.clockwork.EXTRA_SKIP_IF_SAME_VERSION";
    private static final String KEY_COMPRESSION_ALG =
            "com.google.android.clockwork.EXTRA_KEY_COMPRESSION_ALG";
    private static final String KEY_COMPANION_SDK_VERSION =
            "com.google.android.clockwork.EXTRA_KEY_COMPANION_SDK_VERSION";
    private static final String KEY_COMPANION_DEVICE_VERSION =
            "com.google.android.clockwork.EXTRA_KEY_COMPANION_DEVICE_VERSION";
    private static final String KEY_SHOULD_CHECK_GMS_DEPENDENCY =
            "com.google.android.clockwork.EXTRA_KEY_SHOULD_CHECK_GMS_DEPENDENCY";

    public static String getPackageName(Bundle b) {
        return b.getString(Intent.EXTRA_INSTALLER_PACKAGE_NAME);
    }

    public static Uri getAssetUri(Bundle b) {
        return b.getParcelable(KEY_ASSET_URI);
    }

    public static Bundle setAssetUri(Bundle b, Uri assetUri) {
        b.putParcelable(KEY_ASSET_URI, assetUri);
        return b;
    }

    public static Uri getPermUri(Bundle b) {
        return b.getParcelable(KEY_PERM_URI);
    }

    public static boolean checkPerms(Bundle b) {
        return b.getBoolean(KEY_CHECK_PERMS);
    }

    public static boolean skipIfSameVersion(Bundle b) {
        return b.getBoolean(KEY_SKIP_IF_SAME_VERSION);
    }

    public static int getCompanionSdkVersion(Bundle b) {
        return b.getInt(KEY_COMPANION_SDK_VERSION);
    }

    public static int getCompanionDeviceVersion(Bundle b) {
        return b.getInt(KEY_COMPANION_DEVICE_VERSION);
    }

    public static String getCompressionAlg(Bundle b) {
        return b.getString(KEY_COMPRESSION_ALG);
    }

    public static int getStartId(Bundle b) {
        return b.getInt(KEY_START_ID);
    }

    public static Bundle setStartId(Bundle b, int startId) {
        b.putInt(KEY_START_ID, startId);
        return b;
    }
}