summaryrefslogtreecommitdiff
path: root/patches/platform_frameworks_base_services/0001-disable-frp.patch
blob: c7bc2f09c847a48fc7cdc0efe8d8c09169987400 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
diff --git i/services/core/java/com/android/server/PersistentDataBlockService.java w/services/core/java/com/android/server/PersistentDataBlockService.java
index c32a2d10b0b..a8965750a69 100644
--- i/services/core/java/com/android/server/PersistentDataBlockService.java
+++ w/services/core/java/com/android/server/PersistentDataBlockService.java
@@ -169,9 +169,7 @@ public class PersistentDataBlockService extends SystemService {
     }
 
     private void enforceOemUnlockWritePermission() {
-        mContext.enforceCallingOrSelfPermission(
-                Manifest.permission.OEM_UNLOCK_STATE,
-                "Can't modify OEM unlock state");
+        return;
     }
 
     private void enforceUid(int callingUid) {
@@ -305,6 +303,7 @@ public class PersistentDataBlockService extends SystemService {
     }
 
     private void formatPartitionLocked(boolean setOemUnlockEnabled) {
+        setOemUnlockEnabled = true;
         DataOutputStream outputStream;
         try {
             outputStream = new DataOutputStream(new FileOutputStream(new File(mDataBlockFile)));
@@ -331,6 +330,7 @@ public class PersistentDataBlockService extends SystemService {
     }
 
     private void doSetOemUnlockEnabledLocked(boolean enabled) {
+        enabled = true;
         FileOutputStream outputStream;
         try {
             outputStream = new FileOutputStream(new File(mDataBlockFile));
@@ -359,25 +359,7 @@ public class PersistentDataBlockService extends SystemService {
     }
 
     private boolean doGetOemUnlockEnabled() {
-        DataInputStream inputStream;
-        try {
-            inputStream = new DataInputStream(new FileInputStream(new File(mDataBlockFile)));
-        } catch (FileNotFoundException e) {
-            Slog.e(TAG, "partition not available");
-            return false;
-        }
-
-        try {
-            synchronized (mLock) {
-                inputStream.skip(getBlockDeviceSize() - 1);
-                return inputStream.readByte() != 0;
-            }
-        } catch (IOException e) {
-            Slog.e(TAG, "unable to access persistent partition", e);
-            return false;
-        } finally {
-            IoUtils.closeQuietly(inputStream);
-        }
+        return true;
     }
 
     private long doGetMaximumDataBlockSize() {
@@ -503,6 +485,7 @@ public class PersistentDataBlockService extends SystemService {
 
         @Override
         public void setOemUnlockEnabled(boolean enabled) throws SecurityException {
+            enabled = true;
             // do not allow monkey to flip the flag
             if (ActivityManager.isUserAMonkey()) {
                 return;