├── .gitignore ├── settings.gradle ├── README.md ├── zipalign ├── .gitignore ├── src │ └── main │ │ ├── jni │ │ ├── Application.mk │ │ ├── ZipAlign.h │ │ ├── Android.mk │ │ ├── zipalign │ │ │ ├── android │ │ │ │ ├── native │ │ │ │ │ ├── include │ │ │ │ │ │ └── utils │ │ │ │ │ │ │ ├── Atomic.h │ │ │ │ │ │ │ ├── SystemClock.h │ │ │ │ │ │ │ ├── Functor.h │ │ │ │ │ │ │ ├── Endian.h │ │ │ │ │ │ │ ├── threads.h │ │ │ │ │ │ │ ├── ashmem.h │ │ │ │ │ │ │ ├── Compat.h │ │ │ │ │ │ │ ├── StopWatch.h │ │ │ │ │ │ │ ├── ZipFileCRO.h │ │ │ │ │ │ │ ├── misc.h │ │ │ │ │ │ │ ├── BufferedTextOutput.h │ │ │ │ │ │ │ ├── LinearTransform.h │ │ │ │ │ │ │ ├── CallStack.h │ │ │ │ │ │ │ ├── StringArray.h │ │ │ │ │ │ │ ├── ByteOrder.h │ │ │ │ │ │ │ ├── Log.h │ │ │ │ │ │ │ ├── ZipUtils.h │ │ │ │ │ │ │ ├── Debug.h │ │ │ │ │ │ │ ├── Singleton.h │ │ │ │ │ │ │ ├── Errors.h │ │ │ │ │ │ │ ├── PropertyMap.h │ │ │ │ │ │ │ ├── RWLock.h │ │ │ │ │ │ │ ├── ThreadDefs.h │ │ │ │ │ │ │ ├── WorkQueue.h │ │ │ │ │ │ │ ├── Mutex.h │ │ │ │ │ │ │ ├── Thread.h │ │ │ │ │ │ │ ├── BitSet.h │ │ │ │ │ │ │ └── Condition.h │ │ │ │ │ └── src │ │ │ │ │ │ └── utils │ │ │ │ │ │ └── SharedBuffer.cpp │ │ │ │ ├── core │ │ │ │ │ └── include │ │ │ │ │ │ ├── cutils │ │ │ │ │ │ ├── partition_utils.h │ │ │ │ │ │ ├── dir_hash.h │ │ │ │ │ │ ├── open_memstream.h │ │ │ │ │ │ ├── uevent.h │ │ │ │ │ │ ├── zygote.h │ │ │ │ │ │ ├── sched_policy.h │ │ │ │ │ │ ├── cpu_info.h │ │ │ │ │ │ ├── bitops.h │ │ │ │ │ │ ├── android_reboot.h │ │ │ │ │ │ ├── iosched_policy.h │ │ │ │ │ │ ├── process_name.h │ │ │ │ │ │ ├── ashmem.h │ │ │ │ │ │ ├── record_stream.h │ │ │ │ │ │ ├── klog.h │ │ │ │ │ │ ├── uio.h │ │ │ │ │ │ ├── memory.h │ │ │ │ │ │ ├── event_tag_map.h │ │ │ │ │ │ ├── jstring.h │ │ │ │ │ │ ├── compiler.h │ │ │ │ │ │ ├── logd.h │ │ │ │ │ │ ├── misc.h │ │ │ │ │ │ ├── logger.h │ │ │ │ │ │ ├── list.h │ │ │ │ │ │ ├── tztime.h │ │ │ │ │ │ ├── str_parms.h │ │ │ │ │ │ ├── config_utils.h │ │ │ │ │ │ ├── qtaguid.h │ │ │ │ │ │ ├── array.h │ │ │ │ │ │ ├── native_handle.h │ │ │ │ │ │ ├── atomic-inline.h │ │ │ │ │ │ ├── properties.h │ │ │ │ │ │ ├── mq.h │ │ │ │ │ │ ├── sockets.h │ │ │ │ │ │ ├── abort_socket.h │ │ │ │ │ │ ├── hashmap.h │ │ │ │ │ │ ├── atomic-x86.h │ │ │ │ │ │ ├── selector.h │ │ │ │ │ │ ├── logprint.h │ │ │ │ │ │ ├── mspace.h │ │ │ │ │ │ └── threads.h │ │ │ │ │ │ ├── zipfile │ │ │ │ │ │ └── zipfile.h │ │ │ │ │ │ ├── system │ │ │ │ │ │ ├── audio_policy.h │ │ │ │ │ │ └── graphics.h │ │ │ │ │ │ └── android │ │ │ │ │ │ └── log.h │ │ │ │ └── base │ │ │ │ │ └── include │ │ │ │ │ └── androidfw │ │ │ │ │ ├── PowerManager.h │ │ │ │ │ ├── misc.h │ │ │ │ │ ├── ZipUtils.h │ │ │ │ │ ├── StreamingZipInflater.h │ │ │ │ │ └── ObbFile.h │ │ │ └── zipalign.h │ │ └── ZipAlign.cpp │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── ru │ │ └── maximoff │ │ └── zipalign │ │ └── ZipAligner.java ├── build.gradle └── proguard-rules.pro ├── ZipAlign-sample.apk └── ZipAlign-sample ├── src └── main │ ├── res │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ ├── values │ │ ├── strings.xml │ │ └── styles.xml │ ├── values-v21 │ │ └── styles.xml │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ ├── layout │ │ └── main.xml │ └── drawable-v24 │ │ └── ic_launcher_foreground.xml │ ├── AndroidManifest.xml │ └── java │ └── ru │ └── maximoff │ └── zasample │ └── MainActivity.java ├── build.gradle └── proguard-rules.pro /.gitignore: -------------------------------------------------------------------------------- 1 | */build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # zipalign-android 2 | Zipalign для Android 3 | -------------------------------------------------------------------------------- /zipalign/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /src/main/jniLibs 3 | /src/main/obj 4 | -------------------------------------------------------------------------------- /ZipAlign-sample.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Maximoff/zipalign-android/HEAD/ZipAlign-sample.apk -------------------------------------------------------------------------------- /ZipAlign-sample/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Maximoff/zipalign-android/HEAD/ZipAlign-sample/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /ZipAlign-sample/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Maximoff/zipalign-android/HEAD/ZipAlign-sample/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /ZipAlign-sample/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Maximoff/zipalign-android/HEAD/ZipAlign-sample/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ZipAlign-sample/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Maximoff/zipalign-android/HEAD/ZipAlign-sample/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ZipAlign-sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Maximoff/zipalign-android/HEAD/ZipAlign-sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /zipalign/src/main/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_ABI := armeabi-v7a arm64-v8a x86 x86_64 2 | APP_STL := c++_static 3 | APP_CPPFLAGS := -frtti -std=c++11 4 | APP_PLATFORM := android-14 5 | -------------------------------------------------------------------------------- /ZipAlign-sample/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Maximoff/zipalign-android/HEAD/ZipAlign-sample/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /ZipAlign-sample/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Maximoff/zipalign-android/HEAD/ZipAlign-sample/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /ZipAlign-sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Maximoff/zipalign-android/HEAD/ZipAlign-sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /ZipAlign-sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Maximoff/zipalign-android/HEAD/ZipAlign-sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /ZipAlign-sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Maximoff/zipalign-android/HEAD/ZipAlign-sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /ZipAlign-sample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ZipAlign-sample 5 | 6 | 7 | -------------------------------------------------------------------------------- /ZipAlign-sample/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /ZipAlign-sample/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /zipalign/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | -------------------------------------------------------------------------------- /ZipAlign-sample/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /ZipAlign-sample/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /zipalign/src/main/java/ru/maximoff/zipalign/ZipAligner.java: -------------------------------------------------------------------------------- 1 | package ru.maximoff.zipalign; 2 | 3 | public class ZipAligner { 4 | public static final int DEFAULT_LEVEL = 4; 5 | 6 | static { 7 | System.loadLibrary("zipalign"); 8 | } 9 | 10 | public static native boolean align(String srcZip, String destZip, int alignLevel, boolean pageAlignSharedLibs); 11 | public static native boolean isAligned(String srcZip, int alignLevel, boolean pageAlignSharedLibs); 12 | } 13 | -------------------------------------------------------------------------------- /ZipAlign-sample/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | 6 | 7 | defaultConfig { 8 | applicationId "ru.maximoff.zasample" 9 | minSdkVersion 14 10 | targetSdkVersion 28 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | api project(':zipalign') 24 | implementation fileTree(dir: 'libs', include: ['*.jar']) 25 | } 26 | -------------------------------------------------------------------------------- /zipalign/src/main/jni/ZipAlign.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifndef _Included_ru_maximoff_zipalign_ZipAligner 4 | #define _Included_ru_maximoff_zipalign_ZipAligner 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | /* 9 | * Class: ru_maximoff_zipalign_ZipAligner 10 | * Method: align 11 | * Signature: (Ljava/lang/String;Ljava/lang/String;IZ)Z 12 | */ 13 | JNIEXPORT jboolean JNICALL Java_ru_maximoff_zipalign_ZipAligner_align 14 | (JNIEnv *, jclass, jstring, jstring, jint, jboolean); 15 | 16 | /* 17 | * Class: ru_maximoff_zipalign_ZipAligner 18 | * Method: isAligned 19 | * Signature: (Ljava/lang/String;IZ)Z 20 | */ 21 | JNIEXPORT jboolean JNICALL Java_ru_maximoff_zipalign_ZipAligner_isAligned 22 | (JNIEnv *, jclass, jstring, jint, jboolean); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | #endif 28 | -------------------------------------------------------------------------------- /zipalign/src/main/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | include $(CLEAR_VARS) 3 | LOCAL_MODULE := zipalign 4 | 5 | LOCAL_SRC_FILES := ZipAlign.cpp \ 6 | zipalign/ZipAlign.cpp \ 7 | zipalign/ZipEntry.cpp \ 8 | zipalign/ZipFile.cpp \ 9 | zipalign/android/native/src/utils/SharedBuffer.cpp \ 10 | zipalign/android/native/src/utils/ZipUtils.cpp \ 11 | zipalign/android/native/src/utils/VectorImpl.cpp 12 | 13 | LOCAL_LDLIBS := -llog -lz 14 | 15 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/zipalign \ 16 | $(LOCAL_PATH)/zipalign/android/base/include \ 17 | $(LOCAL_PATH)/zipalign/android/core/include \ 18 | $(LOCAL_PATH)/zipalign/android/native/include \ 19 | 20 | LOCAL_CFLAGS := -DSILENT -DRARDLL -I$(LOCAL_PATH)/rar -fexceptions -Os -ffunction-sections -fdata-sections -fvisibility=hidden -w -Wl,--gc-sections 21 | 22 | include $(BUILD_SHARED_LIBRARY) 23 | -------------------------------------------------------------------------------- /zipalign/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 28 5 | 6 | defaultConfig { 7 | applicationId "ru.maximoff.zipalign" 8 | minSdkVersion 14 9 | targetSdkVersion 28 10 | versionCode 1 11 | versionName "1.0" 12 | ndk { 13 | abiFilters 'armeabi-v7a', 'x86', 'arm64-v8a', 'x86_64' 14 | } 15 | } 16 | 17 | externalNativeBuild { 18 | ndkBuild { 19 | path 'src/main/jni/Android.mk' 20 | } 21 | } 22 | 23 | buildTypes { 24 | release { 25 | minifyEnabled false 26 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 27 | } 28 | } 29 | } 30 | 31 | dependencies { 32 | implementation fileTree(dir: 'libs', include: ['*.jar']) 33 | } 34 | -------------------------------------------------------------------------------- /zipalign/src/main/jni/zipalign/android/native/include/utils/Atomic.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005 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 | #ifndef ANDROID_UTILS_ATOMIC_H 18 | #define ANDROID_UTILS_ATOMIC_H 19 | 20 | #include 21 | 22 | #endif // ANDROID_UTILS_ATOMIC_H 23 | -------------------------------------------------------------------------------- /zipalign/src/main/jni/zipalign/android/core/include/cutils/partition_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011, 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 | #ifndef __CUTILS_PARTITION_WIPED_H__ 18 | #define __CUTILS_PARTITION_WIPED_H__ 19 | 20 | __BEGIN_DECLS 21 | 22 | int partition_wiped(char *source); 23 | void erase_footer(const char *dev_path, long long size); 24 | 25 | __END_DECLS 26 | 27 | #endif /* __CUTILS_PARTITION_WIPED_H__ */ 28 | -------------------------------------------------------------------------------- /ZipAlign-sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 14 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /zipalign/src/main/jni/ZipAlign.cpp: -------------------------------------------------------------------------------- 1 | #include "ZipAlign.h" 2 | #include 3 | #include 4 | 5 | extern "C" 6 | JNIEXPORT jboolean JNICALL Java_ru_maximoff_zipalign_ZipAligner_align 7 | (JNIEnv *env, jclass cls, jstring str1, jstring str2, jint int1, jboolean boolean1) { 8 | const char *s1 = env->GetStringUTFChars(str1, nullptr); 9 | const char *s2 = env->GetStringUTFChars(str2, nullptr); 10 | const int alignNum = (int)int1; 11 | const bool pageAlignSharedLibs = (bool)boolean1; 12 | if (alignZip(s1, s2, alignNum, 1, pageAlignSharedLibs) != 1) return JNI_FALSE; 13 | else return JNI_TRUE; 14 | } 15 | 16 | extern "C" 17 | JNIEXPORT jboolean JNICALL Java_ru_maximoff_zipalign_ZipAligner_isAligned 18 | (JNIEnv *env, jclass cls, jstring str, jint int1, jboolean boolean1) { 19 | const char *s = env->GetStringUTFChars(str, nullptr); 20 | const int alignNum = (int)int1; 21 | const bool pageAlignSharedLibs = (bool)boolean1; 22 | if(isAlignedZip(s, alignNum, pageAlignSharedLibs) == 1) return JNI_TRUE; 23 | else return JNI_FALSE; 24 | } 25 | -------------------------------------------------------------------------------- /zipalign/src/main/jni/zipalign/android/core/include/cutils/dir_hash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 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 | typedef enum { 18 | SHA_1, 19 | } HashAlgorithm; 20 | 21 | int get_file_hash(HashAlgorithm algorithm, const char *path, 22 | char *output_string, size_t max_output_string); 23 | 24 | int get_recursive_hash_manifest(HashAlgorithm algorithm, 25 | const char *directory_path, 26 | char **output_string); 27 | -------------------------------------------------------------------------------- /zipalign/src/main/jni/zipalign/android/core/include/cutils/open_memstream.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 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 | #ifndef __CUTILS_OPEN_MEMSTREAM_H__ 18 | #define __CUTILS_OPEN_MEMSTREAM_H__ 19 | 20 | #include 21 | 22 | #ifndef HAVE_OPEN_MEMSTREAM 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | FILE *open_memstream(char **bufp, size_t *sizep); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif /*!HAVE_OPEN_MEMSTREAM*/ 35 | 36 | #endif /*__CUTILS_OPEN_MEMSTREAM_H__*/ 37 | -------------------------------------------------------------------------------- /zipalign/src/main/jni/zipalign/android/core/include/cutils/uevent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 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 | #ifndef __CUTILS_UEVENT_H 18 | #define __CUTILS_UEVENT_H 19 | 20 | #include 21 | #include 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | int uevent_open_socket(int buf_sz, bool passcred); 28 | ssize_t uevent_kernel_multicast_recv(int socket, void *buffer, size_t length); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif /* __CUTILS_UEVENT_H */ 35 | -------------------------------------------------------------------------------- /zipalign/src/main/jni/zipalign/android/core/include/cutils/zygote.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 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 | #ifndef __CUTILS_ZYGOTE_H 18 | #define __CUTILS_ZYGOTE_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | int zygote_run_oneshot(int sendStdio, int argc, const char **argv); 25 | int zygote_run(int argc, const char **argv); 26 | int zygote_run_wait(int argc, const char **argv, void (*post_run_func)(int)); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | 32 | #endif /* __CUTILS_ZYGOTE_H */ 33 | -------------------------------------------------------------------------------- /zipalign/src/main/jni/zipalign/android/native/include/utils/SystemClock.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 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 | #ifndef ANDROID_UTILS_SYSTEMCLOCK_H 18 | #define ANDROID_UTILS_SYSTEMCLOCK_H 19 | 20 | #include 21 | #include 22 | 23 | namespace android { 24 | 25 | int setCurrentTimeMillis(int64_t millis); 26 | int64_t uptimeMillis(); 27 | int64_t elapsedRealtime(); 28 | int64_t elapsedRealtimeNano(); 29 | 30 | }; // namespace android 31 | 32 | #endif // ANDROID_UTILS_SYSTEMCLOCK_H 33 | 34 | -------------------------------------------------------------------------------- /zipalign/src/main/jni/zipalign/android/native/include/utils/Functor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 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 | #ifndef ANDROID_FUNCTOR_H 18 | #define ANDROID_FUNCTOR_H 19 | 20 | #include 21 | 22 | namespace android { 23 | 24 | class Functor { 25 | public: 26 | Functor() {} 27 | virtual ~Functor() {} 28 | virtual status_t operator ()(int what, void *data) { 29 | return NO_ERROR; 30 | } 31 | }; 32 | 33 | }; // namespace android 34 | 35 | #endif // ANDROID_FUNCTOR_H 36 | -------------------------------------------------------------------------------- /zipalign/src/main/jni/zipalign/android/base/include/androidfw/PowerManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 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 | #ifndef _ANDROIDFW_POWER_MANAGER_H 18 | #define _ANDROIDFW_POWER_MANAGER_H 19 | 20 | 21 | namespace android { 22 | 23 | enum { 24 | USER_ACTIVITY_EVENT_OTHER = 0, 25 | USER_ACTIVITY_EVENT_BUTTON = 1, 26 | USER_ACTIVITY_EVENT_TOUCH = 2, 27 | 28 | USER_ACTIVITY_EVENT_LAST = USER_ACTIVITY_EVENT_TOUCH, // Last valid event code. 29 | }; 30 | 31 | } // namespace android 32 | 33 | #endif // _ANDROIDFW_POWER_MANAGER_H 34 | -------------------------------------------------------------------------------- /zipalign/src/main/jni/zipalign/android/core/include/cutils/sched_policy.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 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 | #ifndef __CUTILS_SCHED_POLICY_H 18 | #define __CUTILS_SCHED_POLICY_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | typedef enum { 25 | SP_BACKGROUND = 0, 26 | SP_FOREGROUND = 1, 27 | } SchedPolicy; 28 | 29 | extern int set_sched_policy(int tid, SchedPolicy policy); 30 | extern int get_sched_policy(int tid, SchedPolicy *policy); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif /* __CUTILS_SCHED_POLICY_H */ 37 | -------------------------------------------------------------------------------- /zipalign/src/main/jni/zipalign/android/core/include/cutils/cpu_info.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 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 | #ifndef __CUTILS_CPU_INFO_H 18 | #define __CUTILS_CPU_INFO_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | /* returns a string contiaining an ASCII representation of the CPU serial number, 25 | ** or NULL if cpu info not available. 26 | ** The string is a static variable, so don't call free() on it. 27 | */ 28 | extern const char *get_cpu_serial_number(void); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif /* __CUTILS_CPU_INFO_H */ 35 | -------------------------------------------------------------------------------- /ZipAlign-sample/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\tools\adt-bundle-windows-x86_64-20131030\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -keepattributes SourceFile, LineNumberTable 19 | 20 | -renamesourcefileattribute SourceFile 21 | -repackageclasses 22 | 23 | -dontwarn android.arch.** 24 | -dontwarn android.lifecycle.** 25 | -keep class android.arch.** { *; } 26 | -keep class android.lifecycle.** { *; } 27 | 28 | -dontwarn androidx.arch.** 29 | -dontwarn androidx.lifecycle.** 30 | -keep class androidx.arch.** { *; } 31 | -keep class androidx.lifecycle.** { *; } -------------------------------------------------------------------------------- /zipalign/src/main/jni/zipalign/android/core/include/cutils/bitops.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 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 | #ifndef __CUTILS_BITOPS_H 18 | #define __CUTILS_BITOPS_H 19 | 20 | #include 21 | 22 | __BEGIN_DECLS 23 | 24 | static inline int popcount(unsigned int x) { 25 | return __builtin_popcount(x); 26 | } 27 | 28 | static inline int popcountl(unsigned long x) { 29 | return __builtin_popcountl(x); 30 | } 31 | 32 | static inline int popcountll(unsigned long long x) { 33 | return __builtin_popcountll(x); 34 | } 35 | 36 | __END_DECLS 37 | 38 | #endif /* __CUTILS_BITOPS_H */ 39 | -------------------------------------------------------------------------------- /zipalign/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:/tools/adt-bundle-windows-x86_64-20131030/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -keepattributes SourceFile, LineNumberTable 19 | 20 | -renamesourcefileattribute SourceFile 21 | -repackageclasses 22 | 23 | -ignorewarnings 24 | -dontwarn 25 | -dontnote 26 | 27 | -dontwarn android.arch.** 28 | -dontwarn android.lifecycle.** 29 | -keep class android.arch.** { *; } 30 | -keep class android.lifecycle.** { *; } 31 | 32 | -dontwarn androidx.arch.** 33 | -dontwarn androidx.lifecycle.** 34 | -keep class androidx.arch.** { *; } 35 | -keep class androidx.lifecycle.** { *; } -------------------------------------------------------------------------------- /zipalign/src/main/jni/zipalign/android/core/include/cutils/android_reboot.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011, 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 | #ifndef __CUTILS_ANDROID_REBOOT_H__ 18 | #define __CUTILS_ANDROID_REBOOT_H__ 19 | 20 | __BEGIN_DECLS 21 | 22 | /* Commands */ 23 | #define ANDROID_RB_RESTART 0xDEAD0001 24 | #define ANDROID_RB_POWEROFF 0xDEAD0002 25 | #define ANDROID_RB_RESTART2 0xDEAD0003 26 | 27 | /* Flags */ 28 | #define ANDROID_RB_FLAG_NO_SYNC 0x1 29 | #define ANDROID_RB_FLAG_NO_REMOUNT_RO 0x2 30 | 31 | int android_reboot(int cmd, int flags, char *arg); 32 | 33 | __END_DECLS 34 | 35 | #endif /* __CUTILS_ANDROID_REBOOT_H__ */ 36 | -------------------------------------------------------------------------------- /zipalign/src/main/jni/zipalign/android/native/include/utils/Endian.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005 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 | // 18 | // Android endian-ness defines. 19 | // 20 | #ifndef _LIBS_UTILS_ENDIAN_H 21 | #define _LIBS_UTILS_ENDIAN_H 22 | 23 | #if defined(HAVE_ENDIAN_H) 24 | 25 | #include 26 | 27 | #else /*not HAVE_ENDIAN_H*/ 28 | 29 | #define __BIG_ENDIAN 0x1000 30 | #define __LITTLE_ENDIAN 0x0001 31 | 32 | #if defined(HAVE_LITTLE_ENDIAN) 33 | # define __BYTE_ORDER __LITTLE_ENDIAN 34 | #else 35 | # define __BYTE_ORDER __BIG_ENDIAN 36 | #endif 37 | 38 | #endif /*not HAVE_ENDIAN_H*/ 39 | 40 | #endif /*_LIBS_UTILS_ENDIAN_H*/ 41 | -------------------------------------------------------------------------------- /zipalign/src/main/jni/zipalign/android/native/include/utils/threads.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 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 | #ifndef _LIBS_UTILS_THREADS_H 18 | #define _LIBS_UTILS_THREADS_H 19 | 20 | /* 21 | * Please, DO NOT USE! 22 | * 23 | * This file is here only for legacy reasons. Instead, include directly 24 | * the headers you need below. 25 | * 26 | */ 27 | 28 | #include 29 | 30 | #ifdef __cplusplus 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #endif 37 | 38 | #endif // _LIBS_UTILS_THREADS_H 39 | -------------------------------------------------------------------------------- /zipalign/src/main/jni/zipalign/zipalign.h: -------------------------------------------------------------------------------- 1 | #ifndef LIB_ZIPALIGN_H 2 | #define LIB_ZIPALIGN_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | /* 9 | Unless specified, all functions below return 1 on success and 0 on failure. 10 | */ 11 | 12 | /* 13 | in_filename: the input zip/apk filename 14 | out_filename: the output zip/apk filename 15 | alignment: alignment in bytes, for example, 4 provides 32-bit alignment 16 | force: if 1 is given and the target file exists, overwrite it. Use 0 if you do not wish to overwrite the target. 17 | pageAlignSharedLibs: Align .so files to 4096 and other files to alignTo, or all files to alignTo if false.. 18 | 19 | Returns 0 on success. 20 | */ 21 | int alignZip(const char *in_filename, const char *out_filename, 22 | int alignment, int force, bool pageAlignSharedLibs); 23 | 24 | /* 25 | filename: the filename to check for alignment 26 | alignment: alignment in bytes, for example, 4 provides 32-bit alignment 27 | pageAlignSharedLibs: Align .so files to 4096 and other files to alignTo, or all files to alignTo if false.. 28 | 29 | Returns 0 on success. 30 | */ 31 | int isAlignedZip(const char *filename, int alignment, bool pageAlignSharedLibs); 32 | 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | #endif -------------------------------------------------------------------------------- /zipalign/src/main/jni/zipalign/android/core/include/cutils/iosched_policy.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 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 | #ifndef __CUTILS_IOSCHED_POLICY_H 18 | #define __CUTILS_IOSCHED_POLICY_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | typedef enum { 25 | IoSchedClass_NONE, 26 | IoSchedClass_RT, 27 | IoSchedClass_BE, 28 | IoSchedClass_IDLE, 29 | } IoSchedClass; 30 | 31 | extern int android_set_ioprio(int pid, IoSchedClass clazz, int ioprio); 32 | extern int android_get_ioprio(int pid, IoSchedClass *clazz, int *ioprio); 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif /* __CUTILS_IOSCHED_POLICY_H */ 39 | -------------------------------------------------------------------------------- /zipalign/src/main/jni/zipalign/android/core/include/cutils/process_name.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 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 | /** 18 | * Gives the current process a name. 19 | */ 20 | 21 | #ifndef __PROCESS_NAME_H 22 | #define __PROCESS_NAME_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /** 29 | * Sets the current process name. 30 | * 31 | * Warning: This leaks a string every time you call it. Use judiciously! 32 | */ 33 | void set_process_name(const char *process_name); 34 | 35 | /** Gets the current process name. */ 36 | const char *get_process_name(void); 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif /* __PROCESS_NAME_H */ 43 | -------------------------------------------------------------------------------- /zipalign/src/main/jni/zipalign/android/core/include/cutils/ashmem.h: -------------------------------------------------------------------------------- 1 | /* cutils/ashmem.h 2 | ** 3 | ** Copyright 2008 The Android Open Source Project 4 | ** 5 | ** This file is dual licensed. It may be redistributed and/or modified 6 | ** under the terms of the Apache 2.0 License OR version 2 of the GNU 7 | ** General Public License. 8 | */ 9 | 10 | #ifndef _CUTILS_ASHMEM_H 11 | #define _CUTILS_ASHMEM_H 12 | 13 | #include 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | int ashmem_create_region(const char *name, size_t size); 20 | int ashmem_set_prot_region(int fd, int prot); 21 | int ashmem_pin_region(int fd, size_t offset, size_t len); 22 | int ashmem_unpin_region(int fd, size_t offset, size_t len); 23 | int ashmem_get_size_region(int fd); 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | 29 | #ifndef __ASHMEMIOC /* in case someone included too */ 30 | 31 | #define ASHMEM_NAME_LEN 256 32 | 33 | #define ASHMEM_NAME_DEF "dev/ashmem" 34 | 35 | /* Return values from ASHMEM_PIN: Was the mapping purged while unpinned? */ 36 | #define ASHMEM_NOT_PURGED 0 37 | #define ASHMEM_WAS_PURGED 1 38 | 39 | /* Return values from ASHMEM_UNPIN: Is the mapping now pinned or unpinned? */ 40 | #define ASHMEM_IS_UNPINNED 0 41 | #define ASHMEM_IS_PINNED 1 42 | 43 | #endif /* ! __ASHMEMIOC */ 44 | 45 | #endif /* _CUTILS_ASHMEM_H */ 46 | -------------------------------------------------------------------------------- /ZipAlign-sample/src/main/res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 22 | 23 | 28 | 29 |