OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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.base; | 5 package org.chromium.base; |
6 | 6 |
7 import android.annotation.TargetApi; | 7 import android.annotation.TargetApi; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.SharedPreferences; | 9 import android.content.SharedPreferences; |
10 import android.content.pm.PackageInfo; | 10 import android.content.pm.PackageInfo; |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 List<String> pakAndSnapshotFileAssets = new ArrayList<String>(); | 339 List<String> pakAndSnapshotFileAssets = new ArrayList<String>(); |
340 AssetManager manager = mContext.getResources().getAssets(); | 340 AssetManager manager = mContext.getResources().getAssets(); |
341 try { | 341 try { |
342 String[] files = manager.list(""); | 342 String[] files = manager.list(""); |
343 for (String file : files) { | 343 for (String file : files) { |
344 if (file.endsWith(".pak")) pakAndSnapshotFileAssets.add(file); | 344 if (file.endsWith(".pak")) pakAndSnapshotFileAssets.add(file); |
345 } | 345 } |
346 } catch (IOException e) { | 346 } catch (IOException e) { |
347 Log.w(LOGTAG, "Exception while accessing assets: " + e.getMessage(),
e); | 347 Log.w(LOGTAG, "Exception while accessing assets: " + e.getMessage(),
e); |
348 } | 348 } |
349 pakAndSnapshotFileAssets.add("natives_blob.bin"); | |
350 pakAndSnapshotFileAssets.add("snapshot_blob.bin"); | |
351 setMandatoryPaksToExtract(pakAndSnapshotFileAssets.toArray( | 349 setMandatoryPaksToExtract(pakAndSnapshotFileAssets.toArray( |
352 new String[pakAndSnapshotFileAssets.size()])); | 350 new String[pakAndSnapshotFileAssets.size()])); |
353 } | 351 } |
354 | 352 |
355 private ResourceExtractor(Context context) { | 353 private ResourceExtractor(Context context) { |
356 mContext = context.getApplicationContext(); | 354 mContext = context.getApplicationContext(); |
357 } | 355 } |
358 | 356 |
359 /** | 357 /** |
360 * Synchronously wait for the resource extraction to be completed. | 358 * Synchronously wait for the resource extraction to be completed. |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 /** | 473 /** |
476 * Pak extraction not necessarily required by the embedder; we allow them to
skip | 474 * Pak extraction not necessarily required by the embedder; we allow them to
skip |
477 * this process if they call setMandatoryPaksToExtract with a single empty S
tring. | 475 * this process if they call setMandatoryPaksToExtract with a single empty S
tring. |
478 */ | 476 */ |
479 private static boolean shouldSkipPakExtraction() { | 477 private static boolean shouldSkipPakExtraction() { |
480 // Must call setMandatoryPaksToExtract before beginning resource extract
ion. | 478 // Must call setMandatoryPaksToExtract before beginning resource extract
ion. |
481 assert sMandatoryPaks != null; | 479 assert sMandatoryPaks != null; |
482 return sMandatoryPaks.length == 1 && "".equals(sMandatoryPaks[0]); | 480 return sMandatoryPaks.length == 1 && "".equals(sMandatoryPaks[0]); |
483 } | 481 } |
484 } | 482 } |
OLD | NEW |