AppClone: Changes in AppInfo page for cloned app.

- Hides preferences for cloneable apps under Cloned Apps page
- Displays Create option for cloneable apps under Cloned Apps page.
- Invokes CloneBackend on click of create and refreshes to display newly
  cloned app's AppInfo page.
- Appends suffix 'clone' for cloneable/cloned app.
- Displays text 'Delete' instead of 'uninstall'.

Screencast: https://screencast.googleplex.com/cast/NjI3MDEyMjk1MzAxNTI5NnxhOTIxZDhiZC03Zg

Bug: 262375058
Test: make RunSettingsRoboTests -j64

Change-Id: I34018f6cc7420d2667c25fbca59c832b398d723e
This commit is contained in:
Ankita Vyas
2022-12-13 09:49:56 +00:00
parent 23a91ff7d9
commit 3672fb4b85
7 changed files with 277 additions and 2 deletions

View File

@@ -16,6 +16,8 @@
package com.android.settings.applications.manageapplications;
import static android.util.FeatureFlagUtils.SETTINGS_ENABLE_SPA;
import static androidx.recyclerview.widget.RecyclerView.SCROLL_STATE_DRAGGING;
import static androidx.recyclerview.widget.RecyclerView.SCROLL_STATE_IDLE;
@@ -46,6 +48,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageItemInfo;
import android.content.pm.UserInfo;
import android.content.res.Configuration;
import android.graphics.drawable.Drawable;
import android.net.Uri;
@@ -61,6 +64,7 @@ import android.preference.PreferenceFrameLayout;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.ArraySet;
import android.util.FeatureFlagUtils;
import android.util.IconDrawableFactory;
import android.util.Log;
import android.view.LayoutInflater;
@@ -144,6 +148,8 @@ import com.android.settings.notification.ConfigureNotificationSettings;
import com.android.settings.notification.NotificationBackend;
import com.android.settings.notification.app.AppNotificationSettings;
import com.android.settings.spa.SpaActivity;
import com.android.settings.spa.app.appinfo.AppInfoSettingsProvider;
import com.android.settings.spa.app.appinfo.CloneAppInfoSettingsProvider;
import com.android.settings.widget.LoadingViewController;
import com.android.settings.wifi.AppStateChangeWifiStateBridge;
import com.android.settings.wifi.ChangeWifiStateDetails;
@@ -703,6 +709,20 @@ public class ManageApplications extends InstrumentedFragment
startAppInfoFragment(LongBackgroundTasksDetails.class,
R.string.long_background_tasks_label);
break;
case LIST_TYPE_CLONED_APPS:
if (!FeatureFlagUtils.isEnabled(getContext(), SETTINGS_ENABLE_SPA)) {
return;
}
int userId = UserHandle.getUserId(mCurrentUid);
UserInfo userInfo = mUserManager.getUserInfo(userId);
if (userInfo != null && !userInfo.isCloneProfile()) {
SpaActivity.startSpaActivity(getContext(), CloneAppInfoSettingsProvider.INSTANCE
.getRoute(mCurrentPkgName, userId));
} else {
SpaActivity.startSpaActivity(getContext(), AppInfoSettingsProvider.INSTANCE
.getRoute(mCurrentPkgName, userId));
}
break;
// TODO: Figure out if there is a way where we can spin up the profile's settings
// process ahead of time, to avoid a long load of data when user clicks on a managed
// app. Maybe when they load the list of apps that contains managed profile apps.