summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGeorge Mount <mount@google.com>2014-09-19 16:03:20 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-09-19 16:03:20 +0000
commit4e049e59f28571b95a518b460a222cc3d40a4bb0 (patch)
tree15ec98b51a5dc37e1e21bd793e7809aa53b081c9 /core
parent392251f06eaf36a96e5f9fb4754ad8f9dda5329b (diff)
parentedbffaadf9173984208263d2f57904fb95a3b2bc (diff)
downloadframeworks_base-4e049e59f28571b95a518b460a222cc3d40a4bb0.zip
frameworks_base-4e049e59f28571b95a518b460a222cc3d40a4bb0.tar.gz
frameworks_base-4e049e59f28571b95a518b460a222cc3d40a4bb0.tar.bz2
am 156e8dd2: am f187823e: Merge "Fix exception when fragment container has no View." into lmp-dev
* commit '156e8dd238af85224df15a80bc43c47bdff3f2ba': Fix exception when fragment container has no View.
Diffstat (limited to 'core')
-rw-r--r--core/java/android/app/Activity.java5
-rw-r--r--core/java/android/app/BackStackRecord.java6
-rw-r--r--core/java/android/app/Fragment.java5
-rw-r--r--core/java/android/app/FragmentManager.java1
4 files changed, 17 insertions, 0 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 5f3ed61..25c4897 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -745,6 +745,11 @@ public class Activity extends ContextThemeWrapper
public View findViewById(int id) {
return Activity.this.findViewById(id);
}
+ @Override
+ public boolean hasView() {
+ Window window = Activity.this.getWindow();
+ return (window != null && window.peekDecorView() != null);
+ }
};
// Most recent call to requestVisibleBehind().
diff --git a/core/java/android/app/BackStackRecord.java b/core/java/android/app/BackStackRecord.java
index 832e1e3..8644c3d 100644
--- a/core/java/android/app/BackStackRecord.java
+++ b/core/java/android/app/BackStackRecord.java
@@ -868,6 +868,9 @@ final class BackStackRecord extends FragmentTransaction implements
*/
private void calculateFragments(SparseArray<Fragment> firstOutFragments,
SparseArray<Fragment> lastInFragments) {
+ if (!mManager.mContainer.hasView()) {
+ return; // nothing to see, so no transitions
+ }
Op op = mHead;
while (op != null) {
switch (op.cmd) {
@@ -923,6 +926,9 @@ final class BackStackRecord extends FragmentTransaction implements
*/
public void calculateBackFragments(SparseArray<Fragment> firstOutFragments,
SparseArray<Fragment> lastInFragments) {
+ if (!mManager.mContainer.hasView()) {
+ return; // nothing to see, so no transitions
+ }
Op op = mHead;
while (op != null) {
switch (op.cmd) {
diff --git a/core/java/android/app/Fragment.java b/core/java/android/app/Fragment.java
index f8b321e..c49012b 100644
--- a/core/java/android/app/Fragment.java
+++ b/core/java/android/app/Fragment.java
@@ -2014,6 +2014,11 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
}
return mView.findViewById(id);
}
+
+ @Override
+ public boolean hasView() {
+ return (mView != null);
+ }
}, this);
}
diff --git a/core/java/android/app/FragmentManager.java b/core/java/android/app/FragmentManager.java
index b87b022..ccceef4 100644
--- a/core/java/android/app/FragmentManager.java
+++ b/core/java/android/app/FragmentManager.java
@@ -395,6 +395,7 @@ final class FragmentManagerState implements Parcelable {
*/
interface FragmentContainer {
public View findViewById(int id);
+ public boolean hasView();
}
/**