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

Commit 6e171e05 authored by Ankita Vyas's avatar Ankita Vyas
Browse files

AppClone: Do not show work tab in Cloned Apps page

We do not support app cloning on work profile. Hence even though managed
profile is present on the device, do not show work tab in Cloned Apps
page.

Bug: 248204976
Test: make RunSettingsRoboTests -j
Change-Id: Ib99c34b85b2084b48eb2485787666c95040fa0dc
parent fb2b9f78
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static com.android.settings.Utils.PROPERTY_CLONED_APPS_ENABLED;

import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.UserHandle;
import android.provider.DeviceConfig;

@@ -34,6 +35,7 @@ import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.dashboard.profileselector.ProfileSelectFragment;

import java.util.Arrays;
import java.util.List;
@@ -112,4 +114,16 @@ public class ClonedAppsPreferenceController extends BasePreferenceController
        mPreference.setSummary(mContext.getResources().getString(
                R.string.cloned_apps_summary, clonedAppsCount, availableAppsCount));
    }

    @Override
    public boolean handlePreferenceTreeClick(Preference preference) {
        // Add this extra so that work tab is not displayed on Cloned Apps page.
        if (getPreferenceKey().equals(preference.getKey())) {
            final Bundle extras = preference.getExtras();
            extras.putInt(ProfileSelectFragment.EXTRA_PROFILE,
                    ProfileSelectFragment.ProfileType.PERSONAL);
        }

        return super.handlePreferenceTreeClick(preference);
    }
}