diff options
Diffstat (limited to 'packages/DynamicSystemInstallationService/src')
-rw-r--r-- | packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java index 7093914aa847..f8952ace3cb3 100644 --- a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java +++ b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java @@ -23,6 +23,7 @@ import android.os.AsyncTask; import android.os.MemoryFile; import android.os.ParcelFileDescriptor; import android.os.image.DynamicSystemManager; +import android.service.persistentdata.PersistentDataBlockManager; import android.util.Log; import android.webkit.URLUtil; @@ -133,6 +134,7 @@ class InstallationAsyncTask extends AsyncTask<String, InstallationAsyncTask.Prog private final DynamicSystemManager mDynSystem; private final ProgressListener mListener; private final boolean mIsNetworkUrl; + private final boolean mIsDeviceBootloaderUnlocked; private DynamicSystemManager.Session mInstallationSession; private KeyRevocationList mKeyRevocationList; @@ -160,6 +162,13 @@ class InstallationAsyncTask extends AsyncTask<String, InstallationAsyncTask.Prog mDynSystem = dynSystem; mListener = listener; mIsNetworkUrl = URLUtil.isNetworkUrl(mUrl); + PersistentDataBlockManager pdbManager = + (PersistentDataBlockManager) + mContext.getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE); + mIsDeviceBootloaderUnlocked = + (pdbManager != null) + && (pdbManager.getFlashLockState() + == PersistentDataBlockManager.FLASH_LOCK_UNLOCKED); } @Override @@ -272,7 +281,6 @@ class InstallationAsyncTask extends AsyncTask<String, InstallationAsyncTask.Prog String.format(Locale.US, "Unsupported URL: %s", mUrl)); } - // TODO(yochiang): Bypass this check if device is unlocked try { String listUrl = mContext.getString(R.string.key_revocation_list_url); mKeyRevocationList = KeyRevocationList.fromUrl(new URL(listUrl)); @@ -287,11 +295,12 @@ class InstallationAsyncTask extends AsyncTask<String, InstallationAsyncTask.Prog private void imageValidationThrowOrWarning(ImageValidationException e) throws ImageValidationException { - if (mIsNetworkUrl) { - throw e; - } else { - // If DSU is being installed from a local file URI, then be permissive + if (mIsDeviceBootloaderUnlocked || !mIsNetworkUrl) { + // If device is OEM unlocked or DSU is being installed from a local file URI, + // then be permissive. Log.w(TAG, e.toString()); + } else { + throw e; } } |