-
Notifications
You must be signed in to change notification settings - Fork 901
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5096 from brave/disable_android_permissions
removes unneeded permiossions on Android
- Loading branch information
Showing
9 changed files
with
186 additions
and
3 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
build/android/bytecode/java/org/brave/bytecode/BraveAndroidSyncSettingsClassAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* Copyright (c) 2020 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
package org.brave.bytecode; | ||
|
||
import org.objectweb.asm.ClassVisitor; | ||
|
||
public class BraveAndroidSyncSettingsClassAdapter extends BraveClassVisitor { | ||
static String sAndroidSyncSettingsClassName = | ||
"org/chromium/components/sync/AndroidSyncSettings"; | ||
static String sBraveAndroidSyncSettingsClassName = | ||
"org/chromium/components/sync/BraveAndroidSyncSettings"; | ||
|
||
public BraveAndroidSyncSettingsClassAdapter(ClassVisitor visitor) { | ||
super(visitor); | ||
deleteMethod(sBraveAndroidSyncSettingsClassName, | ||
"notifyObservers"); | ||
makePublicMethod(sAndroidSyncSettingsClassName, | ||
"notifyObservers"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
brave_java_bytecode_files = [ | ||
"../../../brave/build/android/bytecode/java/org/brave/bytecode/BraveClassAdapter.java", | ||
"../../../brave/build/android/bytecode/java/org/brave/bytecode/BraveClassVisitor.java", | ||
"../../../brave/build/android/bytecode/java/org/brave/bytecode/BraveAndroidSyncSettingsClassAdapter.java", | ||
"../../../brave/build/android/bytecode/java/org/brave/bytecode/BraveBookmarkModelClassAdapter.java", | ||
"../../../brave/build/android/bytecode/java/org/brave/bytecode/BraveMainPreferenceBaseClassAdapter.java", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
components/sync/android/java/src/org/chromium/components/sync/BraveAndroidSyncSettings.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* Copyright (c) 2020 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
package org.chromium.components.sync; | ||
|
||
|
||
public class BraveAndroidSyncSettings extends AndroidSyncSettings { | ||
public BraveAndroidSyncSettings(SyncContentResolverDelegate syncContentResolverDelegate) { | ||
super(syncContentResolverDelegate, null); | ||
} | ||
|
||
@Override | ||
protected void setChromeSyncEnabled(boolean value) { | ||
mChromeSyncEnabled = false; | ||
notifyObservers(); | ||
} | ||
|
||
@Override | ||
protected boolean updateCachedSettings() { | ||
boolean oldChromeSyncEnabled = mChromeSyncEnabled; | ||
boolean oldMasterSyncEnabled = mMasterSyncEnabled; | ||
|
||
mIsSyncable = false; | ||
mChromeSyncEnabled = false; | ||
mMasterSyncEnabled = false; | ||
|
||
return oldChromeSyncEnabled != mChromeSyncEnabled | ||
|| oldMasterSyncEnabled != mMasterSyncEnabled; | ||
} | ||
|
||
public void notifyObservers() { | ||
assert false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
brave_sync_java_sources = [ "//brave/components/sync/android/java/src/org/chromium/components/sync/BraveAndroidSyncSettings.java" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
diff --git a/components/sync/android/BUILD.gn b/components/sync/android/BUILD.gn | ||
index fba93d0a3c69ddab8fa3d00b3edd804b535921a1..a382885bf8ee66eb947ba5810726751e2caa7c89 100644 | ||
--- a/components/sync/android/BUILD.gn | ||
+++ b/components/sync/android/BUILD.gn | ||
@@ -32,6 +32,7 @@ android_library("sync_java") { | ||
"java/src/org/chromium/components/sync/notifier/InvalidationPreferences.java", | ||
"java/src/org/chromium/components/sync/notifier/RandomizedInvalidationClientNameGenerator.java", | ||
] | ||
+ sources += brave_sync_java_sources | ||
} | ||
|
||
android_library("sync_javatests") { |
55 changes: 55 additions & 0 deletions
55
...ponents-sync-android-java-src-org-chromium-components-sync-AndroidSyncSettings.java.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
diff --git a/components/sync/android/java/src/org/chromium/components/sync/AndroidSyncSettings.java b/components/sync/android/java/src/org/chromium/components/sync/AndroidSyncSettings.java | ||
index 84a8b66912a2f6847771486e62556b772c192fd2..57e756941d38433c21fb7aaa4bcd472044894cb9 100644 | ||
--- a/components/sync/android/java/src/org/chromium/components/sync/AndroidSyncSettings.java | ||
+++ b/components/sync/android/java/src/org/chromium/components/sync/AndroidSyncSettings.java | ||
@@ -55,11 +55,11 @@ public class AndroidSyncSettings { | ||
|
||
private Account mAccount; | ||
|
||
- private boolean mIsSyncable; | ||
+ protected boolean mIsSyncable; | ||
|
||
- private boolean mChromeSyncEnabled; | ||
+ protected boolean mChromeSyncEnabled; | ||
|
||
- private boolean mMasterSyncEnabled; | ||
+ protected boolean mMasterSyncEnabled; | ||
|
||
private final ObserverList<AndroidSyncSettingsObserver> mObservers = | ||
new ObserverList<AndroidSyncSettingsObserver>(); | ||
@@ -77,7 +77,7 @@ public class AndroidSyncSettings { | ||
if (sInstance == null) { | ||
SyncContentResolverDelegate contentResolver = | ||
new SystemSyncContentResolverDelegate(); | ||
- sInstance = new AndroidSyncSettings(contentResolver); | ||
+ sInstance = new BraveAndroidSyncSettings(contentResolver); | ||
} | ||
return sInstance; | ||
} | ||
@@ -103,7 +103,7 @@ public class AndroidSyncSettings { | ||
* @param callback Callback that will be called after updating account is finished. Boolean | ||
* passed to the callback indicates whether syncability was changed. | ||
*/ | ||
- private AndroidSyncSettings(SyncContentResolverDelegate syncContentResolverDelegate, | ||
+ public AndroidSyncSettings(SyncContentResolverDelegate syncContentResolverDelegate, | ||
@Nullable Callback<Boolean> callback) { | ||
mContractAuthority = ContextUtils.getApplicationContext().getPackageName(); | ||
mSyncContentResolverDelegate = syncContentResolverDelegate; | ||
@@ -211,7 +211,7 @@ public class AndroidSyncSettings { | ||
} | ||
} | ||
|
||
- private void setChromeSyncEnabled(boolean value) { | ||
+ protected void setChromeSyncEnabled(boolean value) { | ||
synchronized (mLock) { | ||
updateSyncability(null); | ||
if (value == mChromeSyncEnabled || mAccount == null) return; | ||
@@ -295,7 +295,7 @@ public class AndroidSyncSettings { | ||
* | ||
* @return Whether either chromeSyncEnabled or masterSyncEnabled changed. | ||
*/ | ||
- private boolean updateCachedSettings() { | ||
+ protected boolean updateCachedSettings() { | ||
synchronized (mLock) { | ||
boolean oldChromeSyncEnabled = mChromeSyncEnabled; | ||
boolean oldMasterSyncEnabled = mMasterSyncEnabled; |