Merge "Avoid making post state to RESUMED for a PAUSING activity" into qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
ae80cf399a
@@ -17,6 +17,7 @@
|
||||
package android.app.servertransaction;
|
||||
|
||||
import static android.app.servertransaction.ActivityLifecycleItem.ON_RESUME;
|
||||
import static android.app.servertransaction.ActivityLifecycleItem.UNDEFINED;
|
||||
|
||||
import android.annotation.UnsupportedAppUsage;
|
||||
import android.app.ClientTransactionHandler;
|
||||
@@ -38,10 +39,11 @@ public class NewIntentItem extends ClientTransactionItem {
|
||||
|
||||
@UnsupportedAppUsage
|
||||
private List<ReferrerIntent> mIntents;
|
||||
private boolean mResume;
|
||||
|
||||
@Override
|
||||
public int getPostExecutionState() {
|
||||
return ON_RESUME;
|
||||
return mResume ? ON_RESUME : UNDEFINED;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -58,12 +60,13 @@ public class NewIntentItem extends ClientTransactionItem {
|
||||
private NewIntentItem() {}
|
||||
|
||||
/** Obtain an instance initialized with provided params. */
|
||||
public static NewIntentItem obtain(List<ReferrerIntent> intents) {
|
||||
public static NewIntentItem obtain(List<ReferrerIntent> intents, boolean resume) {
|
||||
NewIntentItem instance = ObjectPool.obtain(NewIntentItem.class);
|
||||
if (instance == null) {
|
||||
instance = new NewIntentItem();
|
||||
}
|
||||
instance.mIntents = intents;
|
||||
instance.mResume = resume;
|
||||
|
||||
return instance;
|
||||
}
|
||||
@@ -71,6 +74,7 @@ public class NewIntentItem extends ClientTransactionItem {
|
||||
@Override
|
||||
public void recycle() {
|
||||
mIntents = null;
|
||||
mResume = false;
|
||||
ObjectPool.recycle(this);
|
||||
}
|
||||
|
||||
@@ -80,11 +84,13 @@ public class NewIntentItem extends ClientTransactionItem {
|
||||
/** Write to Parcel. */
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeBoolean(mResume);
|
||||
dest.writeTypedList(mIntents, flags);
|
||||
}
|
||||
|
||||
/** Read from Parcel. */
|
||||
private NewIntentItem(Parcel in) {
|
||||
mResume = in.readBoolean();
|
||||
mIntents = in.createTypedArrayList(ReferrerIntent.CREATOR);
|
||||
}
|
||||
|
||||
@@ -108,18 +114,19 @@ public class NewIntentItem extends ClientTransactionItem {
|
||||
return false;
|
||||
}
|
||||
final NewIntentItem other = (NewIntentItem) o;
|
||||
return Objects.equals(mIntents, other.mIntents);
|
||||
return mResume == other.mResume && Objects.equals(mIntents, other.mIntents);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = 17;
|
||||
result = 31 * result + (mResume ? 1 : 0);
|
||||
result = 31 * result + mIntents.hashCode();
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NewIntentItem{intents=" + mIntents + "}";
|
||||
return "NewIntentItem{intents=" + mIntents + ",resume=" + mResume + "}";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user