Loading services/core/java/com/android/server/pdb/PersistentDataBlockService.java +0 −15 Original line number Diff line number Diff line Loading @@ -170,7 +170,6 @@ public class PersistentDataBlockService extends SystemService { static final int MAX_DATA_BLOCK_SIZE = 1024 * 100; public static final int DIGEST_SIZE_BYTES = 32; private static final String OEM_UNLOCK_PROP = "sys.oem_unlock_allowed"; private static final String FLASH_LOCK_PROP = "ro.boot.flash.locked"; private static final String FLASH_LOCK_LOCKED = "1"; private static final String FLASH_LOCK_UNLOCKED = "0"; Loading Loading @@ -274,7 +273,6 @@ public class PersistentDataBlockService extends SystemService { enforceChecksumValidity(); if (mFrpEnforced) { automaticallyDeactivateFrpIfPossible(); setOemUnlockEnabledProperty(doGetOemUnlockEnabled()); setOldSettingForBackworkCompatibility(mFrpActive); } else { formatIfOemUnlockEnabled(); Loading Loading @@ -302,10 +300,6 @@ public class PersistentDataBlockService extends SystemService { } } private void setOemUnlockEnabledProperty(boolean oemUnlockEnabled) { setProperty(OEM_UNLOCK_PROP, oemUnlockEnabled ? "1" : "0"); } @Override public void onBootPhase(int phase) { // Wait for initialization in onStart to finish Loading Loading @@ -341,7 +335,6 @@ public class PersistentDataBlockService extends SystemService { formatPartitionLocked(true); } } setOemUnlockEnabledProperty(enabled); } private void enforceOemUnlockReadPermission() { Loading Loading @@ -808,17 +801,9 @@ public class PersistentDataBlockService extends SystemService { channel.force(true); } catch (IOException e) { Slog.e(TAG, "unable to access persistent partition", e); return; } finally { setOemUnlockEnabledProperty(enabled); } } @VisibleForTesting void setProperty(String name, String value) { SystemProperties.set(name, value); } private boolean doGetOemUnlockEnabled() { DataInputStream inputStream; try { Loading services/tests/servicestests/src/com/android/server/pdb/PersistentDataBlockServiceTest.java +0 −11 Original line number Diff line number Diff line Loading @@ -86,7 +86,6 @@ public class PersistentDataBlockServiceTest { private File mDataBlockFile; private File mFrpSecretFile; private File mFrpSecretTmpFile; private String mOemUnlockPropertyValue; private boolean mIsUpgradingFromPreV = false; @Mock private UserManager mUserManager; Loading @@ -104,13 +103,6 @@ public class PersistentDataBlockServiceTest { signalInitDone(); } @Override void setProperty(String key, String value) { // Override to capture the value instead of actually setting the property. assertThat(key).isEqualTo("sys.oem_unlock_allowed"); mOemUnlockPropertyValue = value; } @Override boolean isUpgradingFromPreVRelease() { return mIsUpgradingFromPreV; Loading Loading @@ -598,7 +590,6 @@ public class PersistentDataBlockServiceTest { mInterface.setOemUnlockEnabled(true); assertThat(mInterface.getOemUnlockEnabled()).isTrue(); assertThat(mOemUnlockPropertyValue).isEqualTo("1"); } @Test Loading Loading @@ -635,7 +626,6 @@ public class PersistentDataBlockServiceTest { // The current implementation does not check digest before set or get the oem unlock bit. tamperWithDigest(); mInterface.setOemUnlockEnabled(true); assertThat(mOemUnlockPropertyValue).isEqualTo("1"); tamperWithDigest(); assertThat(mInterface.getOemUnlockEnabled()).isTrue(); } Loading Loading @@ -676,7 +666,6 @@ public class PersistentDataBlockServiceTest { mInternalInterface.forceOemUnlockEnabled(true); assertThat(mOemUnlockPropertyValue).isEqualTo("1"); assertThat(readBackingFile(mPdbService.getOemUnlockDataOffset(), 1).array()) .isEqualTo(new byte[] { 1 }); } Loading Loading
services/core/java/com/android/server/pdb/PersistentDataBlockService.java +0 −15 Original line number Diff line number Diff line Loading @@ -170,7 +170,6 @@ public class PersistentDataBlockService extends SystemService { static final int MAX_DATA_BLOCK_SIZE = 1024 * 100; public static final int DIGEST_SIZE_BYTES = 32; private static final String OEM_UNLOCK_PROP = "sys.oem_unlock_allowed"; private static final String FLASH_LOCK_PROP = "ro.boot.flash.locked"; private static final String FLASH_LOCK_LOCKED = "1"; private static final String FLASH_LOCK_UNLOCKED = "0"; Loading Loading @@ -274,7 +273,6 @@ public class PersistentDataBlockService extends SystemService { enforceChecksumValidity(); if (mFrpEnforced) { automaticallyDeactivateFrpIfPossible(); setOemUnlockEnabledProperty(doGetOemUnlockEnabled()); setOldSettingForBackworkCompatibility(mFrpActive); } else { formatIfOemUnlockEnabled(); Loading Loading @@ -302,10 +300,6 @@ public class PersistentDataBlockService extends SystemService { } } private void setOemUnlockEnabledProperty(boolean oemUnlockEnabled) { setProperty(OEM_UNLOCK_PROP, oemUnlockEnabled ? "1" : "0"); } @Override public void onBootPhase(int phase) { // Wait for initialization in onStart to finish Loading Loading @@ -341,7 +335,6 @@ public class PersistentDataBlockService extends SystemService { formatPartitionLocked(true); } } setOemUnlockEnabledProperty(enabled); } private void enforceOemUnlockReadPermission() { Loading Loading @@ -808,17 +801,9 @@ public class PersistentDataBlockService extends SystemService { channel.force(true); } catch (IOException e) { Slog.e(TAG, "unable to access persistent partition", e); return; } finally { setOemUnlockEnabledProperty(enabled); } } @VisibleForTesting void setProperty(String name, String value) { SystemProperties.set(name, value); } private boolean doGetOemUnlockEnabled() { DataInputStream inputStream; try { Loading
services/tests/servicestests/src/com/android/server/pdb/PersistentDataBlockServiceTest.java +0 −11 Original line number Diff line number Diff line Loading @@ -86,7 +86,6 @@ public class PersistentDataBlockServiceTest { private File mDataBlockFile; private File mFrpSecretFile; private File mFrpSecretTmpFile; private String mOemUnlockPropertyValue; private boolean mIsUpgradingFromPreV = false; @Mock private UserManager mUserManager; Loading @@ -104,13 +103,6 @@ public class PersistentDataBlockServiceTest { signalInitDone(); } @Override void setProperty(String key, String value) { // Override to capture the value instead of actually setting the property. assertThat(key).isEqualTo("sys.oem_unlock_allowed"); mOemUnlockPropertyValue = value; } @Override boolean isUpgradingFromPreVRelease() { return mIsUpgradingFromPreV; Loading Loading @@ -598,7 +590,6 @@ public class PersistentDataBlockServiceTest { mInterface.setOemUnlockEnabled(true); assertThat(mInterface.getOemUnlockEnabled()).isTrue(); assertThat(mOemUnlockPropertyValue).isEqualTo("1"); } @Test Loading Loading @@ -635,7 +626,6 @@ public class PersistentDataBlockServiceTest { // The current implementation does not check digest before set or get the oem unlock bit. tamperWithDigest(); mInterface.setOemUnlockEnabled(true); assertThat(mOemUnlockPropertyValue).isEqualTo("1"); tamperWithDigest(); assertThat(mInterface.getOemUnlockEnabled()).isTrue(); } Loading Loading @@ -676,7 +666,6 @@ public class PersistentDataBlockServiceTest { mInternalInterface.forceOemUnlockEnabled(true); assertThat(mOemUnlockPropertyValue).isEqualTo("1"); assertThat(readBackingFile(mPdbService.getOemUnlockDataOffset(), 1).array()) .isEqualTo(new byte[] { 1 }); } Loading