Merge "Adds diagnostic logging for LongScreenshotActivity" into udc-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
0091abfa08
@@ -117,18 +117,22 @@ public class CropView extends View {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Parcelable onSaveInstanceState() {
|
protected Parcelable onSaveInstanceState() {
|
||||||
|
Log.d(TAG, "onSaveInstanceState");
|
||||||
Parcelable superState = super.onSaveInstanceState();
|
Parcelable superState = super.onSaveInstanceState();
|
||||||
|
|
||||||
SavedState ss = new SavedState(superState);
|
SavedState ss = new SavedState(superState);
|
||||||
ss.mCrop = mCrop;
|
ss.mCrop = mCrop;
|
||||||
|
Log.d(TAG, "saving mCrop=" + mCrop);
|
||||||
|
|
||||||
return ss;
|
return ss;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onRestoreInstanceState(Parcelable state) {
|
protected void onRestoreInstanceState(Parcelable state) {
|
||||||
|
Log.d(TAG, "onRestoreInstanceState");
|
||||||
SavedState ss = (SavedState) state;
|
SavedState ss = (SavedState) state;
|
||||||
super.onRestoreInstanceState(ss.getSuperState());
|
super.onRestoreInstanceState(ss.getSuperState());
|
||||||
|
Log.d(TAG, "restoring mCrop=" + ss.mCrop + " (was " + mCrop + ")");
|
||||||
mCrop = ss.mCrop;
|
mCrop = ss.mCrop;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,6 +246,7 @@ public class CropView extends View {
|
|||||||
* Set the given boundary to the given value without animation.
|
* Set the given boundary to the given value without animation.
|
||||||
*/
|
*/
|
||||||
public void setBoundaryPosition(CropBoundary boundary, float position) {
|
public void setBoundaryPosition(CropBoundary boundary, float position) {
|
||||||
|
Log.i(TAG, "setBoundaryPosition: " + boundary + ", position=" + position);
|
||||||
position = (float) getAllowedValues(boundary).clamp(position);
|
position = (float) getAllowedValues(boundary).clamp(position);
|
||||||
switch (boundary) {
|
switch (boundary) {
|
||||||
case TOP:
|
case TOP:
|
||||||
@@ -260,6 +265,7 @@ public class CropView extends View {
|
|||||||
Log.w(TAG, "No boundary selected");
|
Log.w(TAG, "No boundary selected");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Log.i(TAG, "Updated mCrop: " + mCrop);
|
||||||
|
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
@@ -350,26 +356,31 @@ public class CropView extends View {
|
|||||||
mCropInteractionListener = listener;
|
mCropInteractionListener = listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Range getAllowedValues(CropBoundary boundary) {
|
private Range<Float> getAllowedValues(CropBoundary boundary) {
|
||||||
|
float upper = 0f;
|
||||||
|
float lower = 1f;
|
||||||
switch (boundary) {
|
switch (boundary) {
|
||||||
case TOP:
|
case TOP:
|
||||||
return new Range<>(0f,
|
lower = 0f;
|
||||||
mCrop.bottom - pixelDistanceToFraction(mCropTouchMargin,
|
upper = mCrop.bottom - pixelDistanceToFraction(mCropTouchMargin,
|
||||||
CropBoundary.BOTTOM));
|
CropBoundary.BOTTOM);
|
||||||
|
break;
|
||||||
case BOTTOM:
|
case BOTTOM:
|
||||||
return new Range<>(
|
lower = mCrop.top + pixelDistanceToFraction(mCropTouchMargin, CropBoundary.TOP);
|
||||||
mCrop.top + pixelDistanceToFraction(mCropTouchMargin,
|
upper = 1;
|
||||||
CropBoundary.TOP), 1f);
|
break;
|
||||||
case LEFT:
|
case LEFT:
|
||||||
return new Range<>(0f,
|
lower = 0f;
|
||||||
mCrop.right - pixelDistanceToFraction(mCropTouchMargin,
|
upper = mCrop.right - pixelDistanceToFraction(mCropTouchMargin, CropBoundary.RIGHT);
|
||||||
CropBoundary.RIGHT));
|
break;
|
||||||
case RIGHT:
|
case RIGHT:
|
||||||
return new Range<>(
|
lower = mCrop.left + pixelDistanceToFraction(mCropTouchMargin, CropBoundary.LEFT);
|
||||||
mCrop.left + pixelDistanceToFraction(mCropTouchMargin,
|
upper = 1;
|
||||||
CropBoundary.LEFT), 1f);
|
break;
|
||||||
}
|
}
|
||||||
return null;
|
Log.i(TAG, "getAllowedValues: " + boundary + ", "
|
||||||
|
+ "result=[lower=" + lower + ", upper=" + upper + "]");
|
||||||
|
return new Range<>(lower, upper);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -36,17 +36,18 @@ import android.text.TextUtils;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.ScrollCaptureResponse;
|
import android.view.ScrollCaptureResponse;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewTreeObserver;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
|
|
||||||
import com.android.internal.app.ChooserActivity;
|
import com.android.internal.app.ChooserActivity;
|
||||||
import com.android.internal.logging.UiEventLogger;
|
import com.android.internal.logging.UiEventLogger;
|
||||||
|
import com.android.internal.view.OneShotPreDrawListener;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.dagger.qualifiers.Background;
|
import com.android.systemui.dagger.qualifiers.Background;
|
||||||
import com.android.systemui.dagger.qualifiers.Main;
|
import com.android.systemui.dagger.qualifiers.Main;
|
||||||
import com.android.systemui.flags.FeatureFlags;
|
import com.android.systemui.flags.FeatureFlags;
|
||||||
|
import com.android.systemui.screenshot.CropView.CropBoundary;
|
||||||
import com.android.systemui.screenshot.ScrollCaptureController.LongScreenshot;
|
import com.android.systemui.screenshot.ScrollCaptureController.LongScreenshot;
|
||||||
import com.android.systemui.settings.UserTracker;
|
import com.android.systemui.settings.UserTracker;
|
||||||
|
|
||||||
@@ -215,6 +216,7 @@ public class LongScreenshotActivity extends Activity {
|
|||||||
mPreview.setImageDrawable(drawable);
|
mPreview.setImageDrawable(drawable);
|
||||||
mMagnifierView.setDrawable(mLongScreenshot.getDrawable(),
|
mMagnifierView.setDrawable(mLongScreenshot.getDrawable(),
|
||||||
mLongScreenshot.getWidth(), mLongScreenshot.getHeight());
|
mLongScreenshot.getWidth(), mLongScreenshot.getHeight());
|
||||||
|
Log.i(TAG, "Completed: " + longScreenshot);
|
||||||
// Original boundaries go from the image tile set's y=0 to y=pageSize, so
|
// Original boundaries go from the image tile set's y=0 to y=pageSize, so
|
||||||
// we animate to that as a starting crop position.
|
// we animate to that as a starting crop position.
|
||||||
float topFraction = Math.max(0,
|
float topFraction = Math.max(0,
|
||||||
@@ -223,12 +225,11 @@ public class LongScreenshotActivity extends Activity {
|
|||||||
1 - (mLongScreenshot.getBottom() - mLongScreenshot.getPageHeight())
|
1 - (mLongScreenshot.getBottom() - mLongScreenshot.getPageHeight())
|
||||||
/ (float) mLongScreenshot.getHeight());
|
/ (float) mLongScreenshot.getHeight());
|
||||||
|
|
||||||
|
Log.i(TAG, "topFraction: " + topFraction);
|
||||||
|
Log.i(TAG, "bottomFraction: " + bottomFraction);
|
||||||
|
|
||||||
mEnterTransitionView.setImageDrawable(drawable);
|
mEnterTransitionView.setImageDrawable(drawable);
|
||||||
mEnterTransitionView.getViewTreeObserver().addOnPreDrawListener(
|
OneShotPreDrawListener.add(mEnterTransitionView, () -> {
|
||||||
new ViewTreeObserver.OnPreDrawListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onPreDraw() {
|
|
||||||
mEnterTransitionView.getViewTreeObserver().removeOnPreDrawListener(this);
|
|
||||||
updateImageDimensions();
|
updateImageDimensions();
|
||||||
mEnterTransitionView.post(() -> {
|
mEnterTransitionView.post(() -> {
|
||||||
Rect dest = new Rect();
|
Rect dest = new Rect();
|
||||||
@@ -236,17 +237,13 @@ public class LongScreenshotActivity extends Activity {
|
|||||||
mLongScreenshotHolder.takeTransitionDestinationCallback()
|
mLongScreenshotHolder.takeTransitionDestinationCallback()
|
||||||
.setTransitionDestination(dest, () -> {
|
.setTransitionDestination(dest, () -> {
|
||||||
mPreview.animate().alpha(1f);
|
mPreview.animate().alpha(1f);
|
||||||
mCropView.setBoundaryPosition(
|
mCropView.setBoundaryPosition(CropBoundary.TOP, topFraction);
|
||||||
CropView.CropBoundary.TOP, topFraction);
|
mCropView.setBoundaryPosition(CropBoundary.BOTTOM, bottomFraction);
|
||||||
mCropView.setBoundaryPosition(
|
|
||||||
CropView.CropBoundary.BOTTOM, bottomFraction);
|
|
||||||
mCropView.animateEntrance();
|
mCropView.animateEntrance();
|
||||||
mCropView.setVisibility(View.VISIBLE);
|
mCropView.setVisibility(View.VISIBLE);
|
||||||
setButtonsEnabled(true);
|
setButtonsEnabled(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Immediately export to temp image file for saved state
|
// Immediately export to temp image file for saved state
|
||||||
|
|||||||
@@ -130,8 +130,14 @@ public class ScrollCaptureController {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "LongScreenshot{w=" + mImageTileSet.getWidth()
|
return "LongScreenshot{"
|
||||||
+ ", h=" + mImageTileSet.getHeight() + "}";
|
+ "l=" + mImageTileSet.getLeft() + ", "
|
||||||
|
+ "t=" + mImageTileSet.getTop() + ", "
|
||||||
|
+ "r=" + mImageTileSet.getRight() + ", "
|
||||||
|
+ "b=" + mImageTileSet.getBottom() + ", "
|
||||||
|
+ "w=" + mImageTileSet.getWidth() + ", "
|
||||||
|
+ "h=" + mImageTileSet.getHeight()
|
||||||
|
+ "}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public Drawable getDrawable() {
|
public Drawable getDrawable() {
|
||||||
|
|||||||
Reference in New Issue
Block a user