Merge "Dumping the excoded view hierarchy instead of the default activity dump" into ub-launcher3-edmonton
This commit is contained in:
commit
9638caf6e4
Binary file not shown.
|
@ -24,7 +24,9 @@ import static com.android.launcher3.LauncherState.OVERVIEW;
|
||||||
import static com.android.launcher3.allapps.DiscoveryBounce.HOME_BOUNCE_SEEN;
|
import static com.android.launcher3.allapps.DiscoveryBounce.HOME_BOUNCE_SEEN;
|
||||||
import static com.android.launcher3.allapps.DiscoveryBounce.SHELF_BOUNCE_SEEN;
|
import static com.android.launcher3.allapps.DiscoveryBounce.SHELF_BOUNCE_SEEN;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.util.Base64;
|
||||||
|
|
||||||
import com.android.launcher3.AbstractFloatingView;
|
import com.android.launcher3.AbstractFloatingView;
|
||||||
import com.android.launcher3.DeviceProfile;
|
import com.android.launcher3.DeviceProfile;
|
||||||
|
@ -32,13 +34,19 @@ import com.android.launcher3.Launcher;
|
||||||
import com.android.launcher3.LauncherState;
|
import com.android.launcher3.LauncherState;
|
||||||
import com.android.launcher3.LauncherStateManager;
|
import com.android.launcher3.LauncherStateManager;
|
||||||
import com.android.launcher3.LauncherStateManager.StateHandler;
|
import com.android.launcher3.LauncherStateManager.StateHandler;
|
||||||
|
import com.android.launcher3.Utilities;
|
||||||
import com.android.launcher3.anim.AnimatorPlaybackController;
|
import com.android.launcher3.anim.AnimatorPlaybackController;
|
||||||
import com.android.launcher3.util.TouchController;
|
import com.android.launcher3.util.TouchController;
|
||||||
import com.android.quickstep.OverviewInteractionState;
|
import com.android.quickstep.OverviewInteractionState;
|
||||||
import com.android.quickstep.RecentsModel;
|
import com.android.quickstep.RecentsModel;
|
||||||
import com.android.quickstep.views.RecentsView;
|
import com.android.quickstep.views.RecentsView;
|
||||||
|
import com.android.systemui.shared.system.ActivityCompat;
|
||||||
import com.android.systemui.shared.system.WindowManagerWrapper;
|
import com.android.systemui.shared.system.WindowManagerWrapper;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.util.zip.Deflater;
|
||||||
|
|
||||||
public class UiFactory {
|
public class UiFactory {
|
||||||
|
|
||||||
public static TouchController[] createTouchControllers(Launcher launcher) {
|
public static TouchController[] createTouchControllers(Launcher launcher) {
|
||||||
|
@ -167,6 +175,32 @@ public class UiFactory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean dumpActivity(Activity activity, PrintWriter writer) {
|
||||||
|
if (!Utilities.IS_DEBUG_DEVICE) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
|
if (!(new ActivityCompat(activity).encodeViewHierarchy(out))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Deflater deflater = new Deflater();
|
||||||
|
deflater.setInput(out.toByteArray());
|
||||||
|
deflater.finish();
|
||||||
|
|
||||||
|
out.reset();
|
||||||
|
byte[] buffer = new byte[1024];
|
||||||
|
while (!deflater.finished()) {
|
||||||
|
int count = deflater.deflate(buffer); // returns the generated code... index
|
||||||
|
out.write(buffer, 0, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.println("--encoded-view-dump-v0--");
|
||||||
|
writer.println(Base64.encodeToString(
|
||||||
|
out.toByteArray(), Base64.NO_WRAP | Base64.NO_PADDING));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private static class LauncherTaskViewController extends TaskViewTouchController<Launcher> {
|
private static class LauncherTaskViewController extends TaskViewTouchController<Launcher> {
|
||||||
|
|
||||||
public LauncherTaskViewController(Launcher activity) {
|
public LauncherTaskViewController(Launcher activity) {
|
||||||
|
|
|
@ -30,8 +30,10 @@ import android.view.View.AccessibilityDelegate;
|
||||||
|
|
||||||
import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
|
import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
|
||||||
import com.android.launcher3.logging.UserEventDispatcher;
|
import com.android.launcher3.logging.UserEventDispatcher;
|
||||||
|
import com.android.launcher3.uioverrides.UiFactory;
|
||||||
import com.android.launcher3.util.SystemUiController;
|
import com.android.launcher3.util.SystemUiController;
|
||||||
|
|
||||||
|
import java.io.FileDescriptor;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -224,6 +226,13 @@ public abstract class BaseActivity extends Activity {
|
||||||
void onMultiWindowModeChanged(boolean isInMultiWindowMode);
|
void onMultiWindowModeChanged(boolean isInMultiWindowMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
|
||||||
|
if (!UiFactory.dumpActivity(this, writer)) {
|
||||||
|
super.dump(prefix, fd, writer, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void dumpMisc(PrintWriter writer) {
|
protected void dumpMisc(PrintWriter writer) {
|
||||||
writer.println(" deviceProfile isTransposed=" + getDeviceProfile().isVerticalBarLayout());
|
writer.println(" deviceProfile isTransposed=" + getDeviceProfile().isVerticalBarLayout());
|
||||||
writer.println(" orientation=" + getResources().getConfiguration().orientation);
|
writer.println(" orientation=" + getResources().getConfiguration().orientation);
|
||||||
|
|
|
@ -16,12 +16,15 @@
|
||||||
|
|
||||||
package com.android.launcher3.uioverrides;
|
package com.android.launcher3.uioverrides;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import com.android.launcher3.Launcher;
|
import com.android.launcher3.Launcher;
|
||||||
import com.android.launcher3.LauncherStateManager.StateHandler;
|
import com.android.launcher3.LauncherStateManager.StateHandler;
|
||||||
import com.android.launcher3.util.TouchController;
|
import com.android.launcher3.util.TouchController;
|
||||||
|
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
|
||||||
public class UiFactory {
|
public class UiFactory {
|
||||||
|
|
||||||
public static TouchController[] createTouchControllers(Launcher launcher) {
|
public static TouchController[] createTouchControllers(Launcher launcher) {
|
||||||
|
@ -47,4 +50,9 @@ public class UiFactory {
|
||||||
public static void onLauncherStateOrResumeChanged(Launcher launcher) { }
|
public static void onLauncherStateOrResumeChanged(Launcher launcher) { }
|
||||||
|
|
||||||
public static void onTrimMemory(Launcher launcher, int level) { }
|
public static void onTrimMemory(Launcher launcher, int level) { }
|
||||||
|
|
||||||
|
public static boolean dumpActivity(Activity activity, PrintWriter writer) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue