summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authorGeorge Mount <mount@google.com>2014-09-19 16:15:55 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-09-19 16:15:55 +0000
commit11b751add13b1f6ae1f88af06faa39eeb6395834 (patch)
tree391da50e232f2dd994a1fc0e869c6bf7a89b92a3 /core/java/android
parent754b80c1c8190a7b721c26470b3595b3b34929b7 (diff)
parent30531c834552ebd1ab9aff8e6589a7b4b1b3b05d (diff)
downloadframeworks_base-11b751add13b1f6ae1f88af06faa39eeb6395834.zip
frameworks_base-11b751add13b1f6ae1f88af06faa39eeb6395834.tar.gz
frameworks_base-11b751add13b1f6ae1f88af06faa39eeb6395834.tar.bz2
am 5a988492: am 00877d68: am f187823e: Merge "Fix exception when fragment container has no View." into lmp-dev
* commit '5a98849276e295af41b6704683b3e59c421ae868': Fix exception when fragment container has no View.
Diffstat (limited to 'core/java/android')
-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 a95abab..5196834 100644
--- a/core/java/android/app/Fragment.java
+++ b/core/java/android/app/Fragment.java
@@ -2015,6 +2015,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 ef69fdd..fc761fe 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();
}
/**