-
Notifications
You must be signed in to change notification settings - Fork 890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds preferences and methods to delete Leo conversations on Android #27074
base: master
Are you sure you want to change the base?
Conversation
@diracdeltas let me know do you want me to open an issue for a sec review. I didn't do it as it's basically a fix related to the original sec review for that feature. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
java patching lgtm
@@ -4,8 +4,14 @@ | |||
* License, v. 2.0. If a copy of the MPL was not distributed with this | |||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. --> | |||
|
|||
<TextView xmlns:android="http://schemas.android.com/apk/res/android" | |||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@deeppandya we need LinearLayout
in that case as we need to apply AlertDialogContent
styles to the dialog.
if (!service) { | ||
return; | ||
} | ||
service->DeleteConversations(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we just pass the AIChatService
mojo to the UI instead of passing it via the AIChatSettingsHelper
mojo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we ever passed native services to java via mojo. Why do we need that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are passing AIChatSettingsHelper to Java and its calling a function which then calls the service function only. So why not just pass the Service to Java now that we have one? AIChatSettingsHelper was made before AIChatService and now that it exists maybe we shouldn't add new things to AIChatSettingsHelper
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Shivan is out, but the original privacy requirement from https://github.com/brave/reviews/issues/1768#issuecomment-2536586219 said Is that the case with this PR? If so there should be a test plan that clearing browser history also clears leo or at least any leo conversations with page context. cc @bridiver if this is your understanding since you were involved in the above privacy review. This is also stated in @petemill 's comment here btw https://github.com/brave/reviews/issues/1703#issuecomment-2523752623. The items below should be implemented on Android before this feature is enabled.
|
I think Android uses the same browser data deletion handling as desktop @diracdeltas |
@diracdeltas correct it is the case with this PR. I just added STR3 with that case in the test plan. |
@@ -22,17 +23,30 @@ | |||
import org.chromium.ui.text.SpanApplier.SpanInfo; | |||
|
|||
public class BraveClearBrowsingDataFragmentAdvanced extends ClearBrowsingDataFragmentAdvanced { | |||
ClearBrowsingDataCheckBoxPreference mClearBrowsingDataCheckBoxPreference; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be named to mention that it's the checkbox for AIChat? e.g. mClearAIChatDataCheckBoxPreference
?
@Override | ||
protected void onClearBrowsingData() { | ||
super.onClearBrowsingData(); | ||
if (mClearBrowsingDataCheckBoxPreference != null | ||
&& mClearBrowsingDataCheckBoxPreference.isChecked()) { | ||
Profile profile = getProfile(); | ||
if (profile == null) { | ||
return; | ||
} | ||
BraveLeoMojomHelper.getInstance(profile).deleteConversations(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this? Hopefully it gets handled by the shared browser code: https://github.com/brave/brave-core/blob/master/browser/browsing_data/brave_browsing_data_remover_delegate.cc#L55-L79
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Desktop's settings WebUI we add a new checkbox with a browser.clear_data.brave_leo
key (should have been ai_chat
!). The desktop WebUI (and assume somewhere in android preferences) we call browsing_data::GetDataTypeFromDeletionPreference
which we override to provide BrowsingDataType::BRAVE_AI_CHAT
when the browser.clear_data.brave_leo
key is provided. And the rest is handled by the delegate.
Issues:
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
wikinpm run presubmit
wiki,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan:
STR 1:
Settings->Leo->Delete all Leo AI conversation data
and click confirm.STR 2:
Settings->Brave Shields & privacy->Delete browsing data
and go toAdvanced
tab there.Leo AI
and clickDelete data
and confirm it.STR 3(make sure that deleting browsing history deletes any related web page visit from conversations):
Settings->Brave Shields & privacy->Delete browsing data
and go toBasic
tab there. Make sureBrowsing history
is checked there