Skip to content

Commit

Permalink
Fixed crash accessing 'send to devices' in share menu via Sync (#21168)
Browse files Browse the repository at this point in the history
Fixes brave/brave-browser#34636

Related Chromium commit:
https://source.chromium.org/chromium/chromium/src/+/84ed1f62ecd64bbfc3d2c4775a6e80a6b0e9defb

Clean up SendTabToSelfSigninPromo flag

Enabled by default in M119 (https://crrev.com/c/4905024), can be
cleaned up in M120.

Fixed: 1479693, 1295204
Change-Id: Ic778e9c886a5d9391fb5da7510d166952481fe21
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4905343
Reviewed-by: Boris Sazonov <bsazonov@chromium.org>
Reviewed-by: Wenyu Fu <wenyufu@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Commit-Queue: Victor Vianna <victorvianna@google.com>
Cr-Commit-Position: refs/heads/main@{#1204655}
  • Loading branch information
AlexeyBarabash authored Dec 1, 2023
1 parent d1384a7 commit 693e8ae
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions android/java/apk_for_test.flags
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,7 @@

-keep class org.chromium.chrome.browser.share.send_tab_to_self.ManageAccountDevicesLinkView {
public <init>(...);
*** getSharingAccountInfo(...);
}

-keep class org.chromium.chrome.browser.share.send_tab_to_self.BraveManageAccountDevicesLinkView {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
import org.chromium.components.omnibox.AutocompleteMatch;
import org.chromium.components.omnibox.action.OmniboxActionDelegate;
import org.chromium.components.permissions.PermissionDialogController;
import org.chromium.components.signin.base.AccountInfo;
import org.chromium.content_public.browser.BrowserContextHandle;
import org.chromium.ui.ViewProvider;
import org.chromium.ui.base.ActivityWindowAndroid;
Expand Down Expand Up @@ -560,6 +561,13 @@ public void testMethodsExist() throws Exception {
"calculateButtonData",
true,
void.class));
Assert.assertTrue(
methodExists(
"org/chromium/chrome/browser/share/"
+ "send_tab_to_self/ManageAccountDevicesLinkView",
"getSharingAccountInfo",
true,
AccountInfo.class));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,25 @@
import android.view.View;
import android.widget.LinearLayout;

import org.chromium.components.signin.base.AccountCapabilities;
import org.chromium.components.signin.base.AccountInfo;
import org.chromium.components.signin.base.CoreAccountId;

public class BraveManageAccountDevicesLinkView extends LinearLayout {
public BraveManageAccountDevicesLinkView(Context context, AttributeSet attrs) {
super(context, attrs);

setVisibility(View.GONE);
}

public static AccountInfo getSharingAccountInfo() {
return new AccountInfo(
new CoreAccountId(""),
"",
"",
null,
null,
null,
new AccountCapabilities(new String[0], new boolean[0]));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,10 @@ public BraveManageAccountDevicesLinkViewClassAdapter(ClassVisitor visitor) {
super(visitor);

changeSuperName(sManageAccountDevicesLinkView, sBraveManageAccountDevicesLinkView);

changeMethodOwner(
sManageAccountDevicesLinkView,
"getSharingAccountInfo",
sBraveManageAccountDevicesLinkView);
}
}
1 change: 1 addition & 0 deletions test/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,7 @@ if (is_android) {
"//components/password_manager/core/browser:password_manager_java_enums",
"//components/permissions/android:java",
"//components/search_engines/android:java",
"//components/signin/public/android:java",
"//components/sync/android:sync_java",
"//components/variations/android:variations_java",
"//content/public/android:content_full_java",
Expand Down

0 comments on commit 693e8ae

Please sign in to comment.