Merge "Moving some tests to robolectric" into ub-launcher3-master
This commit is contained in:
commit
ebc50f3095
11 files changed
+425
-144
No files matched your search
@@ -484,8 +484,6 @@ public class LauncherProvider extends ContentProvider {
|
||||
*/
|
||||
private AutoInstallsLayout createWorkspaceLoaderFromAppRestriction(AppWidgetHost widgetHost) {
|
||||
Context ctx = getContext();
|
||||
InvariantDeviceProfile grid = LauncherAppState.getIDP(ctx);
|
||||
|
||||
String authority = Settings.Secure.getString(ctx.getContentResolver(),
|
||||
"launcher3.layout.provider");
|
||||
if (TextUtils.isEmpty(authority)) {
|
||||
@@ -497,13 +495,7 @@ public class LauncherProvider extends ContentProvider {
|
||||
Log.e(TAG, "No provider found for authority " + authority);
|
||||
return null;
|
||||
}
|
||||
Uri uri = new Uri.Builder().scheme("content").authority(authority).path("launcher_layout")
|
||||
.appendQueryParameter("version", "1")
|
||||
.appendQueryParameter("gridWidth", Integer.toString(grid.numColumns))
|
||||
.appendQueryParameter("gridHeight", Integer.toString(grid.numRows))
|
||||
.appendQueryParameter("hotseatSize", Integer.toString(grid.numHotseatIcons))
|
||||
.build();
|
||||
|
||||
Uri uri = getLayoutUri(authority, ctx);
|
||||
try (InputStream in = ctx.getContentResolver().openInputStream(uri)) {
|
||||
// Read the full xml so that we fail early in case of any IO error.
|
||||
String layout = new String(IOUtils.toByteArray(in));
|
||||
@@ -520,6 +512,16 @@ public class LauncherProvider extends ContentProvider {
|
||||
}
|
||||
}
|
||||
|
||||
public static Uri getLayoutUri(String authority, Context ctx) {
|
||||
InvariantDeviceProfile grid = LauncherAppState.getIDP(ctx);
|
||||
return new Uri.Builder().scheme("content").authority(authority).path("launcher_layout")
|
||||
.appendQueryParameter("version", "1")
|
||||
.appendQueryParameter("gridWidth", Integer.toString(grid.numColumns))
|
||||
.appendQueryParameter("gridHeight", Integer.toString(grid.numRows))
|
||||
.appendQueryParameter("hotseatSize", Integer.toString(grid.numHotseatIcons))
|
||||
.build();
|
||||
}
|
||||
|
||||
private DefaultLayoutParser getDefaultLayoutParser(AppWidgetHost widgetHost) {
|
||||
InvariantDeviceProfile idp = LauncherAppState.getIDP(getContext());
|
||||
int defaultLayout = idp.defaultLayoutId;
|
||||
|
||||
@@ -42,6 +42,8 @@ import android.util.LongSparseArray;
|
||||
import android.util.MutableInt;
|
||||
import android.util.TimingLogger;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.launcher3.AppInfo;
|
||||
import com.android.launcher3.FolderInfo;
|
||||
import com.android.launcher3.InstallShortcutReceiver;
|
||||
@@ -271,7 +273,8 @@ public class LoaderTask implements Runnable {
|
||||
this.notify();
|
||||
}
|
||||
|
||||
private void loadWorkspace(List<ShortcutInfo> allDeepShortcuts) {
|
||||
@VisibleForTesting
|
||||
void loadWorkspace(List<ShortcutInfo> allDeepShortcuts) {
|
||||
final Context context = mApp.getContext();
|
||||
final ContentResolver contentResolver = context.getContentResolver();
|
||||
final PackageManagerHelper pmHelper = new PackageManagerHelper(context);
|
||||
|
||||
Reference in new issue
Block a user