Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(933)

Side by Side Diff: apk_minter/src/org/chromium/apkminter/APKMinting.java

Issue 1948033005: Rename MintingExample.template.apk to WebApk.template.apk (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | build/android/rezip/RezipApk.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.apkminter; 5 package org.chromium.apkminter;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.content.Intent; 8 import android.content.Intent;
9 import android.graphics.Bitmap; 9 import android.graphics.Bitmap;
10 import android.graphics.BitmapFactory; 10 import android.graphics.BitmapFactory;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 import java.util.zip.ZipInputStream; 42 import java.util.zip.ZipInputStream;
43 import java.util.zip.ZipOutputStream; 43 import java.util.zip.ZipOutputStream;
44 44
45 import kellinwood.security.zipsigner.ZipSigner; 45 import kellinwood.security.zipsigner.ZipSigner;
46 46
47 /** 47 /**
48 * APKMinting is responsible for client side APK minting, including: loading tem plate APK files, 48 * APKMinting is responsible for client side APK minting, including: loading tem plate APK files,
49 * modified and generate new APK for the request site, and signing the APK. 49 * modified and generate new APK for the request site, and signing the APK.
50 */ 50 */
51 public class APKMinting { 51 public class APKMinting {
52 private static final String MINTING_APK_PREFIX = "org.chromium.minting"; 52 private static final String MINTING_APK_PREFIX = "org.chromium.webapk";
53 private static final String TEMPLATE_APK_NAME = "MintingExample.template.apk "; 53 private static final String TEMPLATE_APK_NAME = "WebApk.template.apk";
Yaron 2016/05/05 21:41:33 Per offline discussoin, I agree with you that this
54 private static final String KEY_STORE_NAME = "minted-apk-release-key-bks"; 54 private static final String KEY_STORE_NAME = "minted-apk-release-key-bks";
55 private static final String KEY_STORE_ALIAS = "minted_apk"; 55 private static final String KEY_STORE_ALIAS = "minted_apk";
56 private static final String KEY_STORE_PASSWORD = "chrome"; 56 private static final String KEY_STORE_PASSWORD = "chrome";
57 private static final String TAG = "cr_APKMinting"; 57 private static final String TAG = "cr_APKMinting";
58 58
59 private static final int BUFFER_SIZE = 8196; 59 private static final int BUFFER_SIZE = 8196;
60 60
61 static { 61 static {
62 Security.insertProviderAt(new org.spongycastle.jce.provider.BouncyCastle Provider(), 1); 62 Security.insertProviderAt(new org.spongycastle.jce.provider.BouncyCastle Provider(), 1);
63 } 63 }
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 try { 206 try {
207 KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType ()); 207 KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType ());
208 keystoreStream = context.getAssets().open(KEY_STORE_NAME); 208 keystoreStream = context.getAssets().open(KEY_STORE_NAME);
209 keystore.load(keystoreStream, KEY_STORE_PASSWORD.toCharArray()); 209 keystore.load(keystoreStream, KEY_STORE_PASSWORD.toCharArray());
210 X509Certificate cert = (X509Certificate) keystore.getCertificate (KEY_STORE_ALIAS); 210 X509Certificate cert = (X509Certificate) keystore.getCertificate (KEY_STORE_ALIAS);
211 PrivateKey privateKey = (PrivateKey) keystore.getKey(KEY_STORE_A LIAS, 211 PrivateKey privateKey = (PrivateKey) keystore.getKey(KEY_STORE_A LIAS,
212 KEY_STORE_PASSWORD.toCharArray()); 212 KEY_STORE_PASSWORD.toCharArray());
213 213
214 // A temporary directory with a unique name is created for each request. 214 // A temporary directory with a unique name is created for each request.
215 // The structure of this directory is: 215 // The structure of this directory is:
216 // --tmp.apk: a copy of MintingExample.template.apk loaded from assets. 216 // --tmp.apk: a copy of WebApk.template.apk loaded from assets.
217 // --/gen: includes all the files after unzip the tmp.apk. 217 // --/gen: includes all the files after unzip the tmp.apk.
218 // --tmp.unsigned.apk: zip the directory "gen" after modifying i ts 218 // --tmp.unsigned.apk: zip the directory "gen" after modifying i ts
219 // AndroidManifest.xml and res folder. 219 // AndroidManifest.xml and res folder.
220 // --tmp.signed.apk: the generated apk after signing tmp.unsigne d.apk. 220 // --tmp.signed.apk: the generated apk after signing tmp.unsigne d.apk.
221 // The final APK is a temporary file copying the content of tmp. signed.apk. 221 // The final APK is a temporary file copying the content of tmp. signed.apk.
222 // It is stored on external storage with a unique name assigned. 222 // It is stored on external storage with a unique name assigned.
223 223
224 // Load template APK from assets folder to the temporary folder. 224 // Load template APK from assets folder to the temporary folder.
225 String requestId = UUID.randomUUID().toString(); 225 String requestId = UUID.randomUUID().toString();
226 String tmpMintingDirPath = context.getCacheDir() + "/" + request Id; 226 String tmpMintingDirPath = context.getCacheDir() + "/" + request Id;
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 try { 453 try {
454 int read = 0; 454 int read = 0;
455 while ((read = inputStream.read(buffer)) > 0) { 455 while ((read = inputStream.read(buffer)) > 0) {
456 outputStream.write(buffer, 0, read); 456 outputStream.write(buffer, 0, read);
457 } 457 }
458 } finally { 458 } finally {
459 outputStream.close(); 459 outputStream.close();
460 } 460 }
461 } 461 }
462 } 462 }
OLDNEW
« no previous file with comments | « no previous file | build/android/rezip/RezipApk.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698