Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9089bca7 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Make Linux terminal option profile aware" into main

parents f85bc089 ed3abffc
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -199,10 +199,11 @@
            android:title="@string/enable_terminal_title"
            android:summary="@string/enable_terminal_summary" />

        <SwitchPreferenceCompat
            android:key="enable_linux_terminal"
        <Preference
            android:key="linux_terminal"
            android:title="@string/enable_linux_terminal_title"
            android:summary="@string/enable_linux_terminal_summary" />
            android:summary="@string/enable_linux_terminal_summary"
            android:fragment="com.android.settings.development.linuxterminal.LinuxTerminalDashboardFragment" />

        <SwitchPreferenceCompat
            android:key="bugreport_in_power"
+27 −0
Original line number Diff line number Diff line
<!--
  Copyright 2024 The Android Open Source Project

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->

<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:settings="http://schemas.android.com/apk/res-auto"
    android:title="@string/enable_linux_terminal_title">

    <com.android.settings.widget.SettingsMainSwitchPreference
        android:key="enable_linux_terminal"
        android:title="@string/enable_linux_terminal_summary"
        settings:controller="com.android.settings.development.linuxterminal.EnableLinuxTerminalPreferenceController" />

</PreferenceScreen>
+4 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.util.ArrayMap;

import com.android.settings.accounts.AccountDashboardFragment;
import com.android.settings.applications.manageapplications.ManageApplications;
import com.android.settings.development.linuxterminal.LinuxTerminalDashboardFragment;
import com.android.settings.deviceinfo.StorageDashboardFragment;
import com.android.settings.inputmethod.AvailableVirtualKeyboardFragment;
import com.android.settings.inputmethod.NewKeyboardLayoutEnabledLocalesFragment;
@@ -52,5 +53,8 @@ public class ProfileFragmentBridge {
                ProfileSelectKeyboardFragment.class.getName());
        FRAGMENT_MAP.put(NewKeyboardLayoutEnabledLocalesFragment.class.getName(),
                ProfileSelectPhysicalKeyboardFragment.class.getName());
        FRAGMENT_MAP.put(
                LinuxTerminalDashboardFragment.class.getName(),
                ProfileSelectLinuxTerminalFragment.class.getName());
    }
}
+23 −13
Original line number Diff line number Diff line
@@ -331,21 +331,27 @@ public abstract class ProfileSelectFragment extends DashboardFragment {

            for (UserInfo userInfo : userInfos) {
                if (userInfo.isMain()) {
                    fragments.add(createAndGetFragment(
                    fragments.add(
                            createAndGetFragment(
                                    ProfileType.PERSONAL,
                                    userInfo.id,
                                    bundle != null ? bundle : new Bundle(),
                                    personalFragmentConstructor));
                } else if (userInfo.isManagedProfile()) {
                    fragments.add(createAndGetFragment(
                    fragments.add(
                            createAndGetFragment(
                                    ProfileType.WORK,
                                    userInfo.id,
                                    bundle != null ? bundle.deepCopy() : new Bundle(),
                                    workFragmentConstructor));
                } else if (Flags.allowPrivateProfile()
                        && android.multiuser.Flags.enablePrivateSpaceFeatures()
                        && userInfo.isPrivateProfile()) {
                    if (!privateSpaceInfoProvider.isPrivateSpaceLocked(context)) {
                        fragments.add(createAndGetFragment(
                        fragments.add(
                                createAndGetFragment(
                                        ProfileType.PRIVATE,
                                        userInfo.id,
                                        bundle != null ? bundle.deepCopy() : new Bundle(),
                                        privateFragmentConstructor));
                    }
@@ -364,8 +370,12 @@ public abstract class ProfileSelectFragment extends DashboardFragment {
    }

    private static Fragment createAndGetFragment(
            @ProfileType int profileType, Bundle bundle, FragmentConstructor fragmentConstructor) {
            @ProfileType int profileType,
            int userId,
            Bundle bundle,
            FragmentConstructor fragmentConstructor) {
        bundle.putInt(EXTRA_PROFILE, profileType);
        bundle.putInt(EXTRA_USER_ID, userId);
        final Fragment fragment = fragmentConstructor.constructAndGetFragment();
        fragment.setArguments(bundle);
        return fragment;
+46 −0
Original line number Diff line number Diff line
/*
 * Copyright 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.settings.dashboard.profileselector;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;

import com.android.settings.development.DeveloperOptionAwareMixin;
import com.android.settings.development.linuxterminal.LinuxTerminalDashboardFragment;

/** Linux terminal preferences at developers option for personal/managed profile. */
public class ProfileSelectLinuxTerminalFragment extends ProfileSelectFragment
        implements DeveloperOptionAwareMixin {

    private static final String TAG = "ProfileSelLinuxTerminalFrag";

    @Override
    protected String getLogTag() {
        return TAG;
    }

    @Override
    @NonNull
    public Fragment[] getFragments() {
        return getFragments(
                getContext(),
                getArguments(),
                LinuxTerminalDashboardFragment::new,
                LinuxTerminalDashboardFragment::new,
                LinuxTerminalDashboardFragment::new);
    }
}
Loading