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
This commit is contained in:
Ankita Vyas
2022-11-23 08:10:17 +00:00
parent fb2b9f78dd
commit 6e171e05f7

View File

@@ -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);
}
}