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

Commit ab7d1848 authored by Yohann Roussel's avatar Yohann Roussel Committed by android-build-merger
Browse files

Merge "Add tests about MultiDex corruption recovering" am: 01e426d1 am: b319cca2

am: 428ce870

Change-Id: Ie1e926d8fe8b73ea98d2df0a8efc91eb26e1fde9
parents 3224cd95 428ce870
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -36,10 +36,8 @@ LOCAL_DEX_PREOPT := false

include $(BUILD_PACKAGE)

ifndef LOCAL_JACK_ENABLED
$(mainDexList): $(full_classes_proguard_jar) | $(MAINDEXCLASSES)
	$(hide) mkdir -p $(dir $@)
	$(MAINDEXCLASSES) $< 1>$@

$(built_dex_intermediate): $(mainDexList)
endif
+3 −1
Original line number Diff line number Diff line
@@ -7,6 +7,8 @@
    <uses-sdk
        android:minSdkVersion="9"
        android:targetSdkVersion="19" />
    <!-- Required for com.android.framework.multidexlegacytestservices.test2 -->
    <uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES"/>

    <application
        android:label="MultiDexLegacyTestServices">
+29 −23
Original line number Diff line number Diff line
@@ -60,30 +60,34 @@ public abstract class AbstractService extends Service implements Runnable {
            // of the result file will be too big.
            RandomAccessFile raf = new RandomAccessFile(resultFile, "rw");
            raf.seek(raf.length());
            if (raf.length() == 0) {
                Log.i(TAG, "Writing 0x42434445 at " + raf.length() + " in " + resultFile.getPath());
                raf.writeInt(0x42434445);
            raf.close();
        } catch (IOException e) {
            e.printStackTrace();
            } else {
                Log.w(TAG, "Service was restarted appending 0x42434445 twice at " + raf.length()
                        + " in " + resultFile.getPath());
                raf.writeInt(0x42434445);
                raf.writeInt(0x42434445);
            }
            raf.close();
            MultiDex.install(applicationContext);
            Log.i(TAG, "Multi dex installation done.");

            int value = getValue();
            Log.i(TAG, "Saving the result (" + value + ") to " + resultFile.getPath());
        try {
            // Append the check value in result file, keeping the constant values already written.
            RandomAccessFile raf = new RandomAccessFile(resultFile, "rw");
            raf = new RandomAccessFile(resultFile, "rw");
            raf.seek(raf.length());
            Log.i(TAG, "Writing result at " + raf.length() + " in " + resultFile.getPath());
            raf.writeInt(value);
            raf.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
            throw new AssertionError(e);
        } finally {
            try {
                // Writing end of processing flags, the existence of the file is the criteria
            RandomAccessFile raf = new RandomAccessFile(new File(applicationContext.getFilesDir(), getId() + ".complete"), "rw");
                RandomAccessFile raf = new RandomAccessFile(
                        new File(applicationContext.getFilesDir(), getId() + ".complete"), "rw");
                Log.i(TAG, "creating complete file " + resultFile.getPath());
                raf.writeInt(0x32333435);
                raf.close();
@@ -91,6 +95,7 @@ public abstract class AbstractService extends Service implements Runnable {
                e.printStackTrace();
            }
        }
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
@@ -119,9 +124,10 @@ public abstract class AbstractService extends Service implements Runnable {
            intermediate = ReflectIntermediateClass.get(45, 80, 20 /* 5 seems enough on a nakasi,
                using 20 to get some margin */);
        } catch (Exception e) {
            e.printStackTrace();
            throw new AssertionError(e);
        }
        int value = new com.android.framework.multidexlegacytestservices.manymethods.Big001().get1() +
        int value =
                new com.android.framework.multidexlegacytestservices.manymethods.Big001().get1() +
                new com.android.framework.multidexlegacytestservices.manymethods.Big002().get2() +
                new com.android.framework.multidexlegacytestservices.manymethods.Big003().get3() +
                new com.android.framework.multidexlegacytestservices.manymethods.Big004().get4() +
+33 −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_PACKAGE_NAME := MultiDexLegacyTestServicesTests2

LOCAL_JAVA_LIBRARIES := android-support-multidex
LOCAL_STATIC_JAVA_LIBRARIES := android-support-test

LOCAL_SDK_VERSION := 9

LOCAL_DEX_PREOPT := false

include $(BUILD_PACKAGE)
+18 −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.multidexlegacytestservices.test2"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="9" />
    <uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES"/>
    <instrumentation
        android:name="android.support.test.runner.AndroidJUnitRunner"
        android:targetPackage="com.android.framework.multidexlegacytestservices" />

    <application
        android:label="multidexlegacytestservices.test2" >
        <uses-library android:name="android.test.runner" />
    </application>

</manifest>
 No newline at end of file
Loading