Removing static instances of UserManagerCompat and AppWidgetManager

> Changing the lifecycle to follow other static objects in Launcher
> Removing compat interface and inlining everything to helpers

Bug: 141376165
Change-Id: I82bd5db1969101de9a7eac77f32728d70195bb35
This commit is contained in:
Sunny Goyal
2019-12-10 12:19:13 -08:00
parent ebc50f3095
commit 337c81f664
43 changed files with 385 additions and 579 deletions

View File

@@ -26,25 +26,25 @@ import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import android.widget.TextView;
import com.android.launcher3.AppInfo;
import com.android.launcher3.BubbleTextView;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import com.android.launcher3.allapps.AlphabeticalAppsList.AdapterItem;
import com.android.launcher3.compat.UserManagerCompat;
import com.android.launcher3.model.AppLaunchTracker;
import com.android.launcher3.touch.ItemClickHandler;
import com.android.launcher3.touch.ItemLongClickListener;
import com.android.launcher3.util.PackageManagerHelper;
import java.util.List;
import androidx.core.view.accessibility.AccessibilityEventCompat;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
import androidx.core.view.accessibility.AccessibilityRecordCompat;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.android.launcher3.AppInfo;
import com.android.launcher3.BubbleTextView;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import com.android.launcher3.allapps.AlphabeticalAppsList.AdapterItem;
import com.android.launcher3.model.AppLaunchTracker;
import com.android.launcher3.pm.UserCache;
import com.android.launcher3.touch.ItemClickHandler;
import com.android.launcher3.touch.ItemLongClickListener;
import com.android.launcher3.util.PackageManagerHelper;
import java.util.List;
/**
* The grid view adapter of all the apps.
*/
@@ -312,7 +312,7 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter.
WorkModeSwitch workModeToggle = holder.itemView.findViewById(R.id.work_mode_toggle);
workModeToggle.refresh();
TextView managedByLabel = holder.itemView.findViewById(R.id.managed_by_label);
boolean anyProfileQuietModeEnabled = UserManagerCompat.getInstance(
boolean anyProfileQuietModeEnabled = UserCache.INSTANCE.get(
managedByLabel.getContext()).isAnyProfileQuietModeEnabled();
managedByLabel.setText(anyProfileQuietModeEnabled
? R.string.work_mode_off_label : R.string.work_mode_on_label);