Skip to content

Commit

Permalink
Revert "Enable Assistant for child accounts."
Browse files Browse the repository at this point in the history
This reverts commit 7c4d25d.

Reason for revert: feature punted to M74

Bug: 914210

Original change's description:
> Enable Assistant for child accounts.
>
> This reverts commit 71f820a ("Disable assistant for child account").
>
> Bug: b:120075638
> Test: built and tested locally
> Change-Id: I59d3d4869ba596fa462a904b8a64a88230c28325
> Reviewed-on: https://chromium-review.googlesource.com/c/1351155
> Commit-Queue: Henrique Nazaré Santos <[email protected]>
> Reviewed-by: Xiyuan Xia <[email protected]>
> Reviewed-by: Xiaohui Chen <[email protected]>
> Reviewed-by: Sam McNally <[email protected]>
> Cr-Commit-Position: refs/heads/master@{#613206}

[email protected],[email protected],[email protected],[email protected]

Bug: b:120075638
Change-Id: I452fba75870677ec70fc3d1bcec3ab433c5361fd
Reviewed-on: https://chromium-review.googlesource.com/c/1447270
Reviewed-by: Xiaohui Chen <[email protected]>
Cr-Commit-Position: refs/branch-heads/3683@{#84}
Cr-Branched-From: e510299-refs/heads/master@{#625896}
  • Loading branch information
Xiaohui Chen authored and Xiaohui Chen committed Jan 31, 2019
1 parent 90a4cdd commit 4234539
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions ash/accelerators/accelerator_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,7 @@ void HandleToggleVoiceInteraction(const ui::Accelerator& accelerator) {
case mojom::AssistantAllowedState::DISALLOWED_BY_ARC_DISALLOWED:
case mojom::AssistantAllowedState::DISALLOWED_BY_FLAG:
case mojom::AssistantAllowedState::DISALLOWED_BY_SUPERVISED_USER:
case mojom::AssistantAllowedState::DISALLOWED_BY_CHILD_USER:
case mojom::AssistantAllowedState::DISALLOWED_BY_INCOGNITO:
// TODO(xiaohuic): show a specific toast.
return;
Expand Down
2 changes: 2 additions & 0 deletions ash/public/interfaces/voice_interaction_controller.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ enum AssistantAllowedState {
DISALLOWED_BY_NONPRIMARY_USER,
// Disallowed because current user is supervised user.
DISALLOWED_BY_SUPERVISED_USER,
// Disallowed because current user is child user.
DISALLOWED_BY_CHILD_USER,
// Disallowed because incognito mode.
DISALLOWED_BY_INCOGNITO,
// Disallowed because the device is in demo mode.
Expand Down
3 changes: 3 additions & 0 deletions chrome/browser/chromeos/arc/arc_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,9 @@ ash::mojom::AssistantAllowedState IsAssistantAllowedForProfile(
if (profile->IsLegacySupervised())
return ash::mojom::AssistantAllowedState::DISALLOWED_BY_SUPERVISED_USER;

if (profile->IsChild())
return ash::mojom::AssistantAllowedState::DISALLOWED_BY_CHILD_USER;

if (chromeos::DemoSession::IsDeviceInDemoMode())
return ash::mojom::AssistantAllowedState::DISALLOWED_BY_DEMO_MODE;

Expand Down
13 changes: 13 additions & 0 deletions chrome/browser/chromeos/arc/arc_util_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "chrome/browser/policy/profile_policy_connector.h"
#include "chrome/browser/policy/profile_policy_connector_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/supervised_user/supervised_user_constants.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h"
#include "chrome/test/base/testing_profile_manager.h"
Expand Down Expand Up @@ -531,6 +532,18 @@ TEST_F(ChromeArcUtilTest, IsAssistantAllowedForProfile_SupervisedUser) {
IsAssistantAllowedForProfile(profile()));
}

TEST_F(ChromeArcUtilTest, IsAssistantAllowedForProfile_ChildUser) {
base::CommandLine::ForCurrentProcess()->InitFromArgv(
{"", "--arc-availability=officially-supported",
"--enable-voice-interaction"});
ScopedLogIn login(GetFakeUserManager(),
AccountId::FromUserEmailGaiaId(
profile()->GetProfileUserName(), kTestGaiaId));
profile()->SetSupervisedUserId(supervised_users::kChildAccountSUID);
EXPECT_EQ(ash::mojom::AssistantAllowedState::DISALLOWED_BY_CHILD_USER,
IsAssistantAllowedForProfile(profile()));
}

TEST_F(ChromeArcUtilTest, IsAssistantAllowedForProfile_Locale) {
profile()->GetTestingPrefService()->SetString(
language::prefs::kApplicationLocale, "he");
Expand Down

0 comments on commit 4234539

Please sign in to comment.