1 /* 2 * Copyright (C) 2019 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.cts.rollback.lib; 18 19 import android.content.pm.VersionedPackage; 20 21 /** 22 * Collection of dummy apps used in tests. 23 */ 24 public class TestApp { 25 public static final String A = "com.android.cts.rollback.lib.testapp.A"; 26 public static final String Apex = "com.android.apex.cts.shim"; 27 28 public static final TestApp A1 = new TestApp("A1", A, 1, /*isApex*/false, 29 "RollbackManagerTestAppA1.apk"); 30 public static final TestApp A2 = new TestApp("A2", A, 2, /*isApex*/false, 31 "RollbackManagerTestAppA2.apk"); 32 public static final TestApp Apex2 = new TestApp("Apex2", Apex, 2, /*isApex*/true, 33 "com.android.apex.cts.shim.v2.apex"); 34 public static final TestApp Apex3 = new TestApp("Apex3", Apex, 3, /*isApex*/true, 35 "com.android.apex.cts.shim.v3.apex"); 36 37 private final String mName; 38 private final String mPackageName; 39 private final long mVersionCode; 40 private final String[] mResourceNames; 41 private final boolean mIsApex; 42 TestApp(String name, String packageName, long versionCode, boolean isApex, String... resourceNames)43 public TestApp(String name, String packageName, long versionCode, boolean isApex, 44 String... resourceNames) { 45 mName = name; 46 mPackageName = packageName; 47 mVersionCode = versionCode; 48 mResourceNames = resourceNames; 49 mIsApex = isApex; 50 } 51 getPackageName()52 String getPackageName() { 53 return mPackageName; 54 } 55 getVersionCode()56 long getVersionCode() { 57 return mVersionCode; 58 } 59 getResourceNames()60 String[] getResourceNames() { 61 return mResourceNames; 62 } 63 getVersionedPackage()64 VersionedPackage getVersionedPackage() { 65 return new VersionedPackage(mPackageName, mVersionCode); 66 } 67 isApex()68 boolean isApex() { 69 return mIsApex; 70 } 71 72 @Override toString()73 public String toString() { 74 return mName; 75 } 76 } 77