Merge "Slim: Initialize new default wallpaper for mm6.0" into mm6.0
diff --git a/config/common.mk b/config/common.mk
index b09b2e1..a0c7346 100644
--- a/config/common.mk
+++ b/config/common.mk
@@ -28,9 +28,7 @@
PRODUCT_COPY_FILES += \
vendor/slim/prebuilt/common/bin/backuptool.sh:install/bin/backuptool.sh \
vendor/slim/prebuilt/common/bin/backuptool.functions:install/bin/backuptool.functions \
- vendor/slim/prebuilt/common/bin/50-slim.sh:system/addon.d/50-slim.sh \
- vendor/slim/prebuilt/common/bin/99-backup.sh:system/addon.d/99-backup.sh \
- vendor/slim/prebuilt/common/etc/backup.conf:system/etc/backup.conf
+ vendor/slim/prebuilt/common/bin/50-slim.sh:system/addon.d/50-slim.sh
# Signature compatibility validation
PRODUCT_COPY_FILES += \
@@ -62,15 +60,11 @@
vendor/slim/prebuilt/common/etc/init.d/90userinit:system/etc/init.d/90userinit \
vendor/slim/prebuilt/common/bin/sysinit:system/bin/sysinit
-# Embed SuperUser
-SUPERUSER_EMBEDDED := true
-
# Required packages
PRODUCT_PACKAGES += \
CellBroadcastReceiver \
Development \
SpareParts \
- Superuser \
su
# Optional packages
@@ -90,7 +84,6 @@
# Extra Optional packages
PRODUCT_PACKAGES += \
- SlimCenter \
SlimLauncher \
LatinIME \
BluetoothExt \
@@ -173,9 +166,18 @@
ifndef SLIM_BUILD_TYPE
SLIM_BUILD_TYPE := UNOFFICIAL
PLATFORM_VERSION_CODENAME := UNOFFICIAL
+endif
+
+ifeq ($(SLIM_BUILD_TYPE),DM)
+ SLIM_POSTFIX := -$(shell date +"%Y%m%d")
+endif
+
+ifndef SLIM_POSTFIX
SLIM_POSTFIX := -$(shell date +"%Y%m%d-%H%M")
endif
+PLATFORM_VERSION_CODENAME := $(SLIM_BUILD_TYPE)
+
# SlimIRC
# export INCLUDE_SLIMIRC=1 for unofficial builds
ifneq ($(filter WEEKLY OFFICIAL,$(SLIM_BUILD_TYPE)),)
@@ -186,11 +188,6 @@
PRODUCT_PACKAGES += SlimIRC
endif
-# Chromium Prebuilt
-ifeq ($(PRODUCT_PREBUILT_WEBVIEWCHROMIUM),yes)
--include prebuilts/chromium/$(TARGET_DEVICE)/chromium_prebuilt.mk
-endif
-
# Set all versions
SLIM_VERSION := Slim-$(PRODUCT_VERSION_MAJOR).$(PRODUCT_VERSION_MINOR).$(PRODUCT_VERSION_MAINTENANCE)-$(SLIM_BUILD_TYPE)$(SLIM_POSTFIX)
SLIM_MOD_VERSION := Slim-$(SLIM_BUILD)-$(PRODUCT_VERSION_MAJOR).$(PRODUCT_VERSION_MINOR).$(PRODUCT_VERSION_MAINTENANCE)-$(SLIM_BUILD_TYPE)$(SLIM_POSTFIX)
diff --git a/prebuilt/common/bin/99-backup.sh b/prebuilt/common/bin/99-backup.sh
deleted file mode 100755
index 50ad9e3..0000000
--- a/prebuilt/common/bin/99-backup.sh
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/sbin/sh
-
-propfile="/system/etc/backup.conf"
-backupfile="/tmp/backup/backup.conf"
-backuppath="/tmp/backup"
-mkdir -p $backuppath
-propbackuppath="$backuppath/prop"
-mkdir -p $propbackuppath
-
-persist_lcd_density=1
-
-load_prop() {
- if [ -f "$1" ]; then
- source "$1"
- fi
-}
-
-backup_prop() {
- cp "/system/build.prop" "$propbackuppath/build.prop"
-}
-
-restore_prop() {
- if [ "$persist_lcd_density" = "1" ]; then
- if [ -f "$propbackuppath/build.prop" ]; then
- local USERLCD=`sed -n -e'/ro\.sf\.lcd_density/s/^.*=//p' $propbackuppath/build.prop`
- busybox sed -i "s|ro.sf.lcd_density=.*|ro.sf.lcd_density=$USERLCD|" /system/build.prop
- fi
- fi
-}
-
-backup_file() {
- if [ -f "$propfile" ]; then
- cp "$propfile" "$backupfile"
- fi
-}
-
-restore_file() {
- if [ -f "$backupfile" ]; then
- cp "$backupfile" "$propfile"
- fi
-}
-
-case "$1" in
- backup)
- backup_file
- load_prop "$backupfile"
- backup_prop
- ;;
- restore)
- restore_file
- load_prop "$backupfile"
- restore_prop
- ;;
- pre-backup)
- ;;
- post-backup)
- ;;
- pre-restore)
- ;;
- post-restore)
- ;;
-esac
-exit 0
diff --git a/prebuilt/common/etc/backup.conf b/prebuilt/common/etc/backup.conf
deleted file mode 100755
index 3cb7190..0000000
--- a/prebuilt/common/etc/backup.conf
+++ /dev/null
@@ -1 +0,0 @@
-persist_lcd_density=1
diff --git a/prebuilt/common/etc/init.d/00banner b/prebuilt/common/etc/init.d/00banner
index c52d9ad..a7b28fd 100644
--- a/prebuilt/common/etc/init.d/00banner
+++ b/prebuilt/common/etc/init.d/00banner
@@ -4,4 +4,4 @@
#
L="log -p i -t slim"
-$L "Welcome to Android `getprop ro.build.version.release` / SlimKat `getprop ro.slim.version`";
+$L "Welcome to Android `getprop ro.build.version.release` / SlimRoms `getprop ro.slim.version`";
diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts
index 7deb3a4..30d8f5d 100644
--- a/sepolicy/file_contexts
+++ b/sepolicy/file_contexts
@@ -20,7 +20,6 @@
/sys/block/mmcblk.*/queue/scheduler -- u:object_r:sysfs_devices_system_iosched:s0
/data/hostapd(/.*)? u:object_r:wifi_data_file:s0
-/data/misc/radio(/.*)? u:object_r:radio_data_file:s0
#############
# Superuser's control sockets
diff --git a/sepolicy/sepolicy.mk b/sepolicy/sepolicy.mk
index abd001d..de903fd 100644
--- a/sepolicy/sepolicy.mk
+++ b/sepolicy/sepolicy.mk
@@ -6,31 +6,3 @@
BOARD_SEPOLICY_DIRS += \
vendor/slim/sepolicy
-BOARD_SEPOLICY_UNION += \
- file.te \
- file_contexts \
- genfs_contexts \
- property_contexts \
- seapp_contexts \
- service_contexts \
- auditd.te \
- adbd.te \
- healthd.te \
- hostapd.te \
- installd.te \
- livedisplay.te \
- netd.te \
- property.te \
- recovery.te \
- shell.te \
- su.te \
- sysinit.te \
- system.te \
- system_app.te \
- system_server.te \
- ueventd.te \
- uncrypt.te \
- userinit.te \
- vold.te \
- zygote.te \
- mac_permissions.xml
diff --git a/sepolicy/service.te b/sepolicy/service.te
new file mode 100644
index 0000000..6979d41
--- /dev/null
+++ b/sepolicy/service.te
@@ -0,0 +1,6 @@
+type edge_gesture_service, system_api_service, system_server_service, service_manager_type;
+type themes_service, system_api_service, system_server_service, service_manager_type;
+type torch_service, system_api_service, system_server_service, service_manager_type;
+type kill_switch_service, system_api_service, system_server_service, service_manager_type;
+type cm_profile_service, system_api_service, system_server_service, service_manager_type;
+type cm_hardware_service, system_api_service, system_server_service, service_manager_type;
diff --git a/sepolicy/service_contexts b/sepolicy/service_contexts
index 57e0eaa..246ae40 100644
--- a/sepolicy/service_contexts
+++ b/sepolicy/service_contexts
@@ -1,6 +1,6 @@
-cmhw u:object_r:system_server_service:s0
-edgegestureservice u:object_r:system_server_service:s0
-themes u:object_r:system_server_service:s0
-torch u:object_r:system_server_service:s0
-killswitch u:object_r:system_server_service:s0
-profile u:object_r:system_server_service:s0
+edgegestureservice u:object_r:edge_gesture_service:s0
+themes u:object_r:themes_service:s0
+torch u:object_r:torch_service:s0
+killswitch u:object_r:kill_switch_service:s0
+profile u:object_r:cm_profile_service:s0
+cmhardware u:object_r:cm_hardware_service:s0
diff --git a/sepolicy/su.te b/sepolicy/su.te
index c2c68fd..9b7d098 100644
--- a/sepolicy/su.te
+++ b/sepolicy/su.te
@@ -2,8 +2,6 @@
## Perms for the daemon
-type sudaemon, domain;
-
userdebug_or_eng(`
domain_trans(init, su_exec, sudaemon)
diff --git a/tools/chromium_prebuilt.sh b/tools/chromium_prebuilt.sh
deleted file mode 100755
index c67d9e3..0000000
--- a/tools/chromium_prebuilt.sh
+++ /dev/null
@@ -1,124 +0,0 @@
-#!/bin/sh
-
-# Copyright (C) 2014 The OmniROM 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.
-
-# This works, but there has to be a better way of reliably getting the root build directory...
-if [ $# -eq 1 ]; then
- TOP=$1
- DEVICE=$TARGET_DEVICE
-elif [[ (-n "$(gettop)") && ($(get_build_var TARGET_DEVICE) != generic)]]; then
- TOP=$(gettop)
- DEVICE=$(get_build_var TARGET_DEVICE)
-else
- echo "Please run envsetup.sh and breakfast/lunch before running this script,"
- echo "or provide the build root directory as the first parameter."
- return 1
-fi
-
-if [[ $ANDROID_PROMPT_PREFIX == *arm* ]]; then
- ARCH=arm
-fi
-
-if [[ $ANDROID_PROMPT_PREFIX == *arm64* ]]; then
- ARCH=arm64
-fi
-
-if [[ $ANDROID_PROMPT_PREFIX == *x86* ]]; then
- ARCH=x86
-fi
-
-TARGET_DIR=$OUT
-LIBS_64=$TARGET_DIR/system/lib64
-PREBUILT_DIR=$TOP/prebuilts/chromium/$DEVICE
-
-if [ -d $PREBUILT_DIR ]; then
- rm -rf $PREBUILT_DIR
-fi
-
-mkdir -p $PREBUILT_DIR
-mkdir -p $PREBUILT_DIR/app
-mkdir -p $PREBUILT_DIR/lib
-
-if [ -d $TARGET_DIR ]; then
- echo "Copying files..."
- cp -r $TARGET_DIR/system/app/webview $PREBUILT_DIR/app
- cp $TARGET_DIR/system/lib/libwebviewchromium.so $PREBUILT_DIR/lib/libwebviewchromium.so
- cp $TARGET_DIR/system/lib/libwebviewchromium_plat_support.so $PREBUILT_DIR/lib/libwebviewchromium_plat_support.so
- cp $TARGET_DIR/system/lib/libwebviewchromium_loader.so $PREBUILT_DIR/lib/libwebviewchromium_loader.so
- if [ -d $LIBS_64 ]; then
- mkdir -p $PREBUILT_DIR/lib64
- cp $LIBS_64/libwebviewchromium.so $PREBUILT_DIR/lib64/libwebviewchromium.so
- cp $LIBS_64/libwebviewchromium_plat_support.so $PREBUILT_DIR/lib64/libwebviewchromium_plat_support.so
- cp $LIBS_64/libwebviewchromium_loader.so $PREBUILT_DIR/lib64/libwebviewchromium_loader.so
- fi
-else
- echo "Please ensure that you have ran a full build prior to running this script!"
- return 1;
-fi
-
-echo "Generating Makefiles..."
-
-HASH=$(git --git-dir=$TOP/external/chromium_org/.git --work-tree=$TOP/external/chromium_org rev-parse --verify HEAD)
-echo $HASH > $PREBUILT_DIR/hash.txt
-
-sed -e s/__DEVICE__/$DEVICE/g -e s/__ARCH__/$ARCH/g > $PREBUILT_DIR/chromium_prebuilt.mk << EOF
-# Copyright (C) 2014 The OmniROM 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 := prebuilts/chromium/__DEVICE__/
-ARCH := __ARCH__
-
-PRODUCT_COPY_FILES += \\
- \$(LOCAL_PATH)/app/webview/webview.apk:system/app/webview/webview.apk \\
- \$(LOCAL_PATH)/lib/libwebviewchromium.so:system/lib/libwebviewchromium.so \\
- \$(LOCAL_PATH)/lib/libwebviewchromium_plat_support.so:system/lib/libwebviewchromium_plat_support.so \\
- \$(LOCAL_PATH)/lib/libwebviewchromium_loader.so:system/lib/libwebviewchromium_loader.so
-
-ifeq (\$(ARCH),arm64)
-PRODUCT_COPY_FILES += \\
- \$(LOCAL_PATH)/lib64/libwebviewchromium.so:system/lib64/libwebviewchromium.so \\
- \$(LOCAL_PATH)/lib64/libwebviewchromium_plat_support.so:system/lib64/libwebviewchromium_plat_support.so \\
- \$(LOCAL_PATH)/lib64/libwebviewchromium_loader.so:system/lib64/libwebviewchromium_loader.so
-endif
-
-ifneq (\$(filter arm arm64,\$(ARCH)),)
-\$(shell mkdir -p out/target/product/__DEVICE__/system/app/webview/lib/arm/)
-\$(shell cp -r \$(LOCAL_PATH)/app/webview/lib/arm/libwebviewchromium.so out/target/product/__DEVICE__/system/app/webview/lib/arm/libwebviewchromium.so)
-endif
-
-ifeq (\$(ARCH),arm64)
-\$(shell mkdir -p out/target/product/__DEVICE__/system/app/webview/lib/arm64/)
-\$(shell cp -r \$(LOCAL_PATH)/app/webview/lib/arm64/libwebviewchromium.so out/target/product/__DEVICE__/system/app/webview/lib/arm64/libwebviewchromium.so)
-endif
-
-ifeq (\$(ARCH),x86)
-\$(shell mkdir -p out/target/product/__DEVICE__/system/app/webview/lib/x86/)
-\$(shell cp -r \$(LOCAL_PATH)/app/webview/lib/x86/libwebviewchromium.so out/target/product/__DEVICE__/system/app/webview/lib/x86/libwebviewchromium.so)
-endif
-
-EOF
-
-echo "Done!"
diff --git a/tools/opticharger b/tools/opticharger
deleted file mode 100755
index a3d7ade..0000000
--- a/tools/opticharger
+++ /dev/null
@@ -1,149 +0,0 @@
-#!/bin/sh
-#
-# Super-mega opticharger of doom
-# Shrinks apks by running pngcrush or optipng or pngout on png images
-#
-# Point APKCERTS at the full path to a generated apkcerts.txt file, such as:
-# /home/shade/dev/sources/android-cm-eclair/out/target/product/dream_sapphire/obj/PACKAGING/target_files_intermediates/cyanogen_dream_sapphire-target_files-eng.shade/META/apkcerts.txt
-#
-# cyanogen - shade@chemlab.org
-# ChrisSoyars - me@ctso.me
-
-set -e
-QUIET=1
-BASE=`pwd`
-BRUTECRUSH="-brute"
-TMPDIR=/tmp/opticharge-$$
-
-if [ -z "$BRUTE_PNGCRUSH" ]
-then
- BRUTECRUSH=""
-fi
-
-if [ "$APKCERTS" = "" ];
-then
- if [ "$TARGET_BUILD_VARIANT" = "userdebug" ]; then
- TARGET_BUILD_VARIANT="eng"
- elif [ "$TARGET_BUILD_VARIANT" = "user" ]; then
- TARGET_BUILD_VARIANT="eng"
- fi
-
- APKCERTS=$OUT/obj/PACKAGING/target_files_intermediates/$TARGET_PRODUCT-target_files-$TARGET_BUILD_VARIANT.$USER/META/apkcerts.txt
- if [ ! -f "$APKCERTS" ];
- then
- echo "Set APKCERTS to the path to your apkcerts.txt file"
- exit 1;
- fi
-fi
-
-if [ ! -f "$APKCERTS" ];
-then
- echo "Invalid path to apkcerts.txt, set APKCERTS to the correct path."
-fi
-
-if [ "$(which pngcrush)" != "" ];
-then
- optimize_png () {
- pngcrush -q ${BRUTECRUSH} $1 ${1}.out 1> /dev/null 2> /dev/null
- mv ${1}.out ${1}
- }
-elif [ "$(which optipng)" != "" ];
-then
- optimize_png () {
- optipng -o7 -quiet $1 1> /dev/null 2> /dev/null
- }
-elif [ "$(which pngout-static)" != "" ];
-then
- optimize_png () {
- pngout-static $1
- }
-elif [ "$(which pngout)" != "" ];
-then
- optimize_png () {
- pngout $1
- }
-else
- echo "Please install pngcrush, optipng, or pngout"
- exit 1;
-fi
-
-if [ "`which aapt`" = "" ];
-then
- echo "Please ensure aapt is in your \$PATH"
- exit 1;
-fi
-
-if [ "`which zipalign`" = "" ];
-then
- echo "Please ensure zipalign is in your \$PATH"
- exit 1;
-fi
-
-if [ -e "$1" ];
-then
- NAME=`basename $1`;
- echo "Optimizing $NAME...";
-
- if [ "$2" != "" ];
- then
- CERT=build/target/product/security/$2.x509.pem
- KEY=build/target/product/security/$2.pk8
- if [ ! -f "$ANDROID_BUILD_TOP/$CERT" ];
- then
- echo "$CERT does not exist!";
- exit 1;
- fi
- else
- APKINFO=`grep "name=\"$NAME\"" $APKCERTS`;
- [ $QUIET ] || echo "APKINFO: $APKINFO";
- if [ "$APKINFO" = "" ];
- then
- echo "No apk info for $NAME";
- exit 1;
- fi
- CERT=`echo $APKINFO | awk {'print $2'} | cut -f 2 -d "=" | tr -d "\""`;
- KEY=`echo $APKINFO | awk {'print $3'} | cut -f 2 -d "=" | tr -d "\""`;
- if [ "$CERT" = "" ];
- then
- echo "Unable to find certificate for $NAME"
- exit 1;
- fi
- if [ "$CERT" = "PRESIGNED" ];
- then
- echo "$NAME is presigned, skipping"
- exit 1;
- fi
- fi
-
- [ $QUIET ] || echo "Certificate: $CERT";
-
- [ -d $TMPDIR/$NAME ] && rm -rf $TMPDIR/$NAME
- mkdir -p $TMPDIR/$NAME
- trap "rm -rf $TMPDIR; exit" INT TERM EXIT
- cd $TMPDIR/$NAME
- unzip -q $BASE/$1
- for x in `find . -name "*.png" | grep -v "\.9.png$" | tr "\n" " "`
- do
- [ $QUIET ] || echo "Crushing $x"
- optimize_png $x
- done
- cp $BASE/$1 $BASE/$1.old
-
- [ $QUIET ] || echo "Repacking apk.."
- aapt p -0 .dat -0 .dict -0 .arsc -F $NAME .
-
- [ $QUIET ] || echo "Resigning with cert: `echo $CERT`"
-
- [ $QUIET ] || echo java -jar $ANDROID_HOST_OUT/framework/signapk.jar $ANDROID_BUILD_TOP/$CERT $ANDROID_BUILD_TOP/$KEY $NAME signed_$NAME
- java -jar $ANDROID_HOST_OUT/framework/signapk.jar $ANDROID_BUILD_TOP/$CERT $ANDROID_BUILD_TOP/$KEY $NAME signed_$NAME
- [ $QUIET ] || echo "Zipalign.."
- zipalign -f 4 signed_$NAME $BASE/$1
- if [ ! $QUIET ]; then
- ls -l $BASE/$1.old
- ls -l $BASE/$1
- fi
- rm $BASE/$1.old
-else
- echo "Usage: $0 [apk file]"
-fi
-
diff --git a/tools/squisher b/tools/squisher
deleted file mode 100755
index c984b81..0000000
--- a/tools/squisher
+++ /dev/null
@@ -1,217 +0,0 @@
-#!/bin/sh
-#
-# Squish a CM otapackage for distribution
-# cyanogen
-#
-
-OUT_TARGET_HOST=`uname -a | grep Darwin`
-if [ -z "$OUT_TARGET_HOST" ]
-then
- OUT_TARGET_HOST=linux-x86
- MD5=md5sum
- XARGS="xargs --max-args=1 --max-procs `grep 'processor' /proc/cpuinfo|wc -l`"
- SED=sed
-else
- OUT_TARGET_HOST=darwin-x86
- MD5=md5
- XARGS="xargs -n 1 -P `sysctl hw.ncpu | awk '{print $2}'`"
- SED=gsed
-fi
-
-if [ -z "$OUT" -o ! -d "$OUT" ]; then
- echo "ERROR: $0 only works with a full build environment. $OUT should exist."
- exit 1
-fi
-
-if [ "$TARGET_BUILD_TYPE" = "debug" ]; then
- OTAPACKAGE=$OUT/${TARGET_PRODUCT}_debug-ota-$TARGET_BUILD_VARIANT.$USER.zip
-elif [ "$TARGET_BUILD_VARIANT" = "userdebug" ]; then
- OTAPACKAGE=$OUT/$TARGET_PRODUCT-ota-eng.$USER.zip
-elif [ "$TARGET_BUILD_VARIANT" = "user" ]; then
- OTAPACKAGE=$OUT/$TARGET_PRODUCT-ota-eng.$USER.zip
-else
- OTAPACKAGE=$OUT/$TARGET_PRODUCT-ota-$TARGET_BUILD_VARIANT.$USER.zip
-fi
-if [ ! -f "$OTAPACKAGE" ]; then
- echo "$OTAPACKAGE doesn't exist!";
- exit 1
-fi
-
-OPTICHARGER=$ANDROID_BUILD_TOP/vendor/slim/tools/opticharger
-QUIET=-q
-DELETE_BINS="applypatch applypatch_static check_prereq recovery updater"
-DELETE_MEDIA="*.qmg"
-DELETE_APKS="LiveWallpapers.apk SpeechRecorder.apk VideoEditor.apk HoloSpiralWallpaper.apk MagicSmokeWallpapers.apk NoiseField.apk Galaxy4.apk OpenWnn.apk PinyinIME.apk"
-DELETE_PRIV_APKS="VoiceDialer.apk"
-DELETE_GALLERY="Gallery2.apk"
-DELETE_FONTS="MTLmr3m.ttf"
-
-REPACK=$OUT/repack.d
-printf "Sanitizing environment..."
-rm -rf $REPACK
-mkdir -p $REPACK
-echo
-
-
-# Unpack the otapackage and opticharge all apks
-mkdir $REPACK/ota
-(
-cd $REPACK/ota
-printf "Unpacking $OTAPACKAGE..."
-unzip $QUIET $OTAPACKAGE
-echo
-
-# Move all apks to the same directory so xargs can
-# use also with framework-res.apk. This allow process
-# framework-res.apk in parallel with other apks
-mkdir -p $REPACK/parallel
-cd $REPACK/parallel
-cp $REPACK/ota/system/framework/framework-res.apk .
-cp $REPACK/ota/system/app/*.apk .
-for f in $REPACK/ota/system/priv-app/*.apk; do
- cp $f ./priv-app-$(basename $f)
-done
-
-
-# Do optimization in parallel
-find ./ -name \*.apk | $XARGS $OPTICHARGER
-
-# Move optimized apks to repack directory
-mv -f $REPACK/parallel/framework-res.apk $REPACK/ota/system/framework/framework-res.apk
-for f in $REPACK/parallel/priv-app*.apk; do
- mv $f $REPACK/ota/system/priv-app/$(basename $f | cut -d'-' -f3)
-done
-mv -f $REPACK/parallel/*.apk $REPACK/ota/system/app/
-
-# Return to directory
-cd $REPACK/ota
-rm -rf $REPACK/parallel
-)
-
-# Fix build.prop
-$SED -i \
- -e '/ro\.kernel\.android\.checkjni/d' \
- -e '/ro\.build\.type/s/eng/user/' \
- $REPACK/ota/system/build.prop
-
-
-# Delete unnecessary binaries
-( cd $REPACK/ota/system/bin; echo $DELETE_BINS | xargs rm -f; )
-
-# Delete Offline charging mode files
-( cd $REPACK/ota/system/media; echo $DELETE_MEDIA | xargs rm -f; )
-
-# Delete Home Apk's
-( cd $REPACK/ota/system/app; echo $DELETE_APKS | xargs rm -f; )
-
-# Delete priv-app Apk's
-( cd $REPACK/ota/system/priv-app; echo $DELETE_PRIV_APKS | xargs rm -f; )
-
-# No need for modem.bin
-rm -f $REPACK/ota/modem.bin
-
-# No need for media/video
-rm -rf $REPACK/ota/system/media/video
-
-# Delete Unnecessary Fonts
-( cd $REPACK/ota/system/fonts; echo $DELETE_FONTS | xargs rm -f; )
-
-# Delete compiled fonts
-#rm -rf $REPACK/ota/system/fonts
-
-#make dir for fonts again
-#mkdir $REPACK/ota/system/fonts
-
-# Add precompiled fonts
-#mv -f $REPACK/ota/system/sfont/*.ttf $REPACK/ota/system/fonts/
-
-# No need for tts
-rm -rf $REPACK/ota/system/tts
-
-# No need for srec
-rm -rf $REPACK/ota/system/usr/srec
-
-# No need for recovery
-rm -rf $REPACK/ota/recovery
-rm -rf $REPACK/ota/system/etc/recovery-resource.dat
-
-# Strip modules
-[ -d $REPACK/ota/system/lib/modules ] && \
- find $REPACK/ota/system/lib/modules -name "*.ko" -print0 | xargs -0 arm-eabi-strip --strip-unneeded
-
-# Fix LCD Density for slim
-DEVICELCD=`sed -n -e'/ro\.sf\.lcd_density/s/^.*=//p' $OUT/system/build.prop`
-if [ "$DEVICELCD" = "240" ]; then
- sed -i 's/ro.sf.lcd_density=240/ro.sf.lcd_density=182/g' $OUT/system/build.prop
-elif [ "$DEVICELCD" = "320" ]; then
- sed -i 's/ro.sf.lcd_density=320/ro.sf.lcd_density=245/g' $OUT/system/build.prop
-elif [ "$DEVICELCD" = "480" ]; then
- sed -i 's/ro.sf.lcd_density=480/ro.sf.lcd_density=370/g' $OUT/system/build.prop
-elif [ "$DEVICELCD" = "213" ]; then
- sed -i 's/ro.sf.lcd_density=213/ro.sf.lcd_density=182/g' $OUT/system/build.prop
-fi
-
-# Device specific LCD Density fix
-DEVICEID=`sed -n -e'/ro\.product\.device/s/^.*=//p' $OUT/system/build.prop`
-if [ "$DEVICEID" = "SGH-I717" ]; then
- sed -i 's/ro.sf.lcd_density=245/ro.sf.lcd_density=268/g' $OUT/system/build.prop
-elif [ "$DEVICEID" = "GT-N7000" ]; then
- sed -i 's/ro.sf.lcd_density=245/ro.sf.lcd_density=268/g' $OUT/system/build.prop
-elif [ "$DEVICEID" = "mako" ]; then
- sed -i 's/ro.sf.lcd_density=245/ro.sf.lcd_density=268/g' $OUT/system/build.prop
-elif [ "$DEVICEID" = "flo" ]; then
- sed -i 's/ro.sf.lcd_density=245/ro.sf.lcd_density=286/g' $OUT/system/build.prop
-elif [ "$DEVICEID" = "deb" ]; then
- sed -i 's/ro.sf.lcd_density=245/ro.sf.lcd_density=286/g' $OUT/system/build.prop
-elif [ "$DEVICEID" = "amami" ]; then
- sed -i 's/ro.sf.lcd_density=245/ro.sf.lcd_density=286/g' $OUT/system/build.prop
-elif [ "$DEVICEID" = "togari" ]; then
- sed -i 's/ro.sf.lcd_density=245/ro.sf.lcd_density=300/g' $OUT/system/build.prop
-fi
-cp -f $OUT/system/build.prop $REPACK/ota/system/build.prop
-
-# Delete Gallery2 for 5MP cameras
-CAMERARESOLUTION=`sed -n -e'/ro\.camera\.res/s/^.*=//p' $REPACK/ota/system/build.prop`
-#if [ "$CAMERARESOLUTION" = "5MP" ];then
-# rm -f $REPACK/ota/system/app/Gallery2.apk
-#fi
-
-# Swap boot.img
-PREBUILTKERNEL=$OUT/system/slimkernel/boot.img
-if [ -e "$PREBUILTKERNEL" ];then
- rm -f $REPACK/ota/boot.img
- mv -f $REPACK/ota/system/slimkernel/boot.img $REPACK/ota/boot.img
-fi
-
-# Determine what to name the new signed package
-MODVERSION=`sed -n -e'/ro\.modversion/s/^.*=//p' $REPACK/ota/system/build.prop`
-OUTFILE=$OUT/$MODVERSION.zip
-echo MODVERSION: $MODVERSION
-
-# Pack it up and sign
-printf "Zipping package..."
-( cd $REPACK/ota; zip $QUIET -r $REPACK/update.zip . )
-echo
-printf "Signing package..."
-SECURITYDIR=$ANDROID_BUILD_TOP/build/target/product/security
-java -Xmx1024m \
- -jar $OUT/../../../host/$OUT_TARGET_HOST/framework/signapk.jar \
- -w $SECURITYDIR/testkey.x509.pem $SECURITYDIR/testkey.pk8 \
- $REPACK/update.zip $OUTFILE
-echo
-printf "Cleaning up..."
-rm -rf $REPACK
-echo
-
-# Create a md5 checksum image of the repacked package
-(
-img=`basename $OUTFILE`
-cd `dirname $OUTFILE`
-$MD5 $img >$img.md5sum
-echo
-echo "Package complete: $OUTFILE"
-cat $img.md5sum
-echo
-)
-
-exit 0