Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2f00e62d authored by Yohann Roussel's avatar Yohann Roussel
Browse files

Add support.multidex tests app for an update bug.

The failing scenario is
- install v1
- run
- update to v2
- update to v3
- run
last run was failing with initial multidex library versions because
it's still running on v1 extracted secondary dex files.

(cherry picked from commit 05e2a94c)

Change-Id: Ibb5d16642b127ee4c0baddc4f6ba461c11d25f90
parent 7b97e426
Loading
Loading
Loading
Loading
+41 −0
Original line number Diff line number Diff line
# Copyright (C) 2014 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.

LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := tests

LOCAL_SRC_FILES := $(call all-java-files-under, src)

LOCAL_SDK_VERSION := 9

LOCAL_PACKAGE_NAME := MultiDexLegacyVersionedTestApp_v1

LOCAL_STATIC_JAVA_LIBRARIES := android-support-multidex

mainDexList:= \
	$(call intermediates-dir-for,APPS,$(LOCAL_PACKAGE_NAME),$(LOCAL_IS_HOST_MODULE),common)/maindex.list

LOCAL_DX_FLAGS := --multi-dex --main-dex-list=$(mainDexList) --minimal-main-dex

include $(BUILD_PACKAGE)

$(mainDexList): $(full_classes_proguard_jar) | $(HOST_OUT_EXECUTABLES)/mainDexClasses
	$(HOST_OUT_EXECUTABLES)/mainDexClasses $< 1>$@
	echo "com/android/framework/multidexlegacyversionedtestapp/MultiDexUpdateTest.class" >> $@

$(built_dex_intermediate): $(mainDexList)
+31 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.android.framework.multidexlegacyversionedtestapp"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="9"
        android:targetSdkVersion="18" />

    <application
        android:name="android.support.multidex.MultiDexApplication"
        android:allowBackup="true"
        android:label="MultiDexLegacyVersionedTestApp_v1">
        <activity
            android:name="com.android.framework.multidexlegacyversionedtestapp.MainActivity"
            android:label="MultiDexLegacyVersionedTestApp_v1" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <uses-library android:name="android.test.runner" />
    </application>

    <instrumentation android:name="android.test.InstrumentationTestRunner"
                     android:targetPackage="com.android.framework.multidexlegacyversionedtestapp"
                     android:label="Test for MultiDexLegacyVersionedTestApp_v1" />

</manifest>
+7 −0
Original line number Diff line number Diff line
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

</RelativeLayout>
+29 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2014 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.framework.multidexlegacyversionedtestapp;

/**
 * Class directly referenced from Activity, will be kept in main dex. The class is not referenced
 * by <clinit> or <init>, its direct references are not kept in main dex.
 */
public class ClassForMainDex {

    public static int getVersion() {
        return Version.getVersion();
    }

}
+34 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2014 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.framework.multidexlegacyversionedtestapp;

import android.app.Activity;
import android.os.Bundle;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    public int getVersion() {
        return ClassForMainDex.getVersion();
    }

}
Loading