forked from PixelExperience/packages_apps_Updates
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
See README-STUDIO.txt for more info. Change-Id: Ie673bba5618b0f00a585049cd85687a64db2b420
- Loading branch information
Gabriele M
committed
Jan 23, 2018
1 parent
7005b00
commit 3fc1749
Showing
6 changed files
with
189 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
.idea | ||
.DS_Store | ||
/build | ||
/captures | ||
/gradle | ||
/gradlew | ||
/gradlew.bat | ||
/system_libs/*.jar | ||
/keystore.properties | ||
*.jks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
How to build with Android Studio | ||
================================ | ||
|
||
Updater needs access to the system API, therefore it can't be built only using | ||
the public SDK. You first need to generate the libraries with all the needed | ||
classes. The application also needs elevated privileges, so you need to sign | ||
it with the right key to update the one in the system partition. To do this: | ||
|
||
- Generate a keystore and keystore.properties using gen-keystore.sh | ||
- Build the dependencies running 'make UpdaterStudio'. This command will add | ||
the needed libraries in system_libraries/. | ||
|
||
You need to do the above once, unless Android Studio can't find some symbol. | ||
In this case, rebuild the system libraries with 'make UpdaterStudio'. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
repositories { | ||
google() | ||
jcenter() | ||
} | ||
|
||
buildscript { | ||
repositories { | ||
google() | ||
jcenter() | ||
} | ||
|
||
dependencies { | ||
classpath 'com.android.tools.build:gradle:3.0.1' | ||
} | ||
} | ||
|
||
def keystorePropertiesFile = rootProject.file("keystore.properties") | ||
def keystoreProperties = new Properties() | ||
keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) | ||
|
||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 24 | ||
buildToolsVersion '26.0.3' | ||
|
||
defaultConfig { | ||
minSdkVersion 24 | ||
targetSdkVersion 24 | ||
} | ||
|
||
lintOptions { | ||
ignore 'ProtectedPermissions' | ||
// These depend on translations | ||
ignore 'ExtraTranslation', 'ImpliedQuantity', 'MissingQuantity', 'MissingTranslation' | ||
} | ||
|
||
sourceSets { | ||
main { | ||
res.srcDirs = ['res'] | ||
java.srcDirs = ['src'] | ||
manifest.srcFile 'AndroidManifest.xml' | ||
} | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
|
||
signingConfigs { | ||
debug { | ||
keyAlias keystoreProperties['keyAlias'] | ||
keyPassword keystoreProperties['keyPassword'] | ||
storeFile file(keystoreProperties['storeFile']) | ||
storePassword keystoreProperties['storePassword'] | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compileOnly fileTree(dir: 'system_libs/', include: ['*.jar']) | ||
|
||
def supportLibVersion = "24.2.1" | ||
implementation "com.android.support:appcompat-v7:${supportLibVersion}" | ||
implementation "com.android.support:cardview-v7:${supportLibVersion}" | ||
implementation "com.android.support:design:${supportLibVersion}" | ||
implementation "com.android.support:preference-v7:${supportLibVersion}" | ||
implementation "com.android.support:recyclerview-v7:${supportLibVersion}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/bin/sh | ||
|
||
if [ $# -ne 6 ]; then | ||
echo "Usage: `basename $0` PRIVATE_KEY CERTIFICATE \\" | ||
echo " KEYSTORE_PASSWRD KEY_PASSWORD KEY_ALIAS \\" | ||
echo " OUTPUT_KEYSTORE_PATH" | ||
echo | ||
echo "Example:" | ||
echo " `basename $0` \\" | ||
echo " ../../../build/target/product/security/testkey.pk8 \\" | ||
echo " ../../../build/target/product/security/testkey.x509.pem \\" | ||
echo " keystore-password key-password android testkey.jks" | ||
exit 0 | ||
fi | ||
|
||
PRIVATE_KEY="$1" | ||
CERTIFICATE="$2" | ||
KEYSTORE_PASSWORD="$3" | ||
KEY_PASSWORD="$4" | ||
KEY_ALIAS="$5" | ||
KEYSTORE_PATH="$6" | ||
|
||
if [ -f "$KEYSTORE_PATH" ]; then | ||
echo "$KEYSTORE_PATH already exists" | ||
exit 1 | ||
fi | ||
|
||
tmpdir=`mktemp -d` | ||
trap 'rm -rf $tmpdir;' 0 | ||
|
||
key="$tmpdir/platform.key" | ||
pk12="$tmpdir/platform.pk12" | ||
openssl pkcs8 -in "$PRIVATE_KEY" -inform DER -outform PEM -nocrypt -out "$key" | ||
if [ $? -ne 0 ]; then | ||
exit 1 | ||
fi | ||
openssl pkcs12 -export -in "$CERTIFICATE" -inkey "$key" -name "$KEY_ALIAS" \ | ||
-out "$pk12" -password pass:"$KEY_PASSWORD" | ||
if [ $? -ne 0 ]; then | ||
exit 1 | ||
fi | ||
|
||
keytool -importkeystore \ | ||
-srckeystore "$pk12" -srcstoretype pkcs12 -srcstorepass "$KEY_PASSWORD" \ | ||
-destkeystore "$KEYSTORE_PATH" -deststorepass "$KEYSTORE_PASSWORD" \ | ||
-destkeypass "$KEY_PASSWORD" | ||
if [ $? -ne 0 ]; then | ||
exit 1 | ||
fi | ||
|
||
|
||
echo | ||
echo "Generating keystore.properties..." | ||
if [ -f keystore.properties ]; then | ||
echo "keystore.properties already exists, overwrite it? [Y/n]" | ||
read reply | ||
if [ "$reply" = "n" -o "$reply" = "N" ]; then | ||
exit 0 | ||
fi | ||
fi | ||
|
||
cat > keystore.properties <<EOF | ||
keyAlias=$KEY_ALIAS | ||
keyPassword=$KEY_PASSWORD | ||
storeFile=$KEYSTORE_PATH | ||
storePassword=$KEYSTORE_PASSWORD | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
keyAlias=android | ||
keyPassword=android | ||
storeFile=testkey.jks | ||
storePassword=android |