summaryrefslogtreecommitdiff
path: root/patches/platform_frameworks_base_services/0001-disable-FRP.patch
blob: d16311893b915efd25246cca426359f994927f88 (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
67
68
69
70
71
72
73
74
75
76
77
78
From 5a539952d2fd876fc06b83de8dee406c2b98cd53 Mon Sep 17 00:00:00 2001
From: dakkar <dakkar@thenautilus.net>
Date: Fri, 13 Jul 2018 10:47:34 +0100
Subject: [PATCH] disable FRP
 
---
 .../android/server/PersistentDataBlockService.java | 27 ++++------------------
 1 file changed, 5 insertions(+), 22 deletions(-)
 
diff --git a/services/core/java/com/android/server/PersistentDataBlockService.java b/services/core/java/com/android/server/PersistentDataBlockService.java
index c32a2d10b0b..a8965750a69 100644
--- a/services/core/java/com/android/server/PersistentDataBlockService.java
+++ b/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;
-- 
2.16.4