Skip to content

Commit 2720cfa

Browse files
Brian ColonnaAndroid (Google) Code Review
authored andcommitted
Merge "Fix 5433466 - FU out of position during orientation change" into ics-mr0
2 parents ee5aa0e + 9d20405 commit 2720cfa

File tree

5 files changed

+29
-16
lines changed

5 files changed

+29
-16
lines changed

core/res/res/layout/keyguard_screen_password_landscape.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@
206206

207207
<!-- Area to overlay FaceLock -->
208208
<TextView android:id="@+id/faceLockAreaView"
209-
android:visibility="gone"
209+
android:visibility="invisible"
210210
android:layout_row="0"
211211
android:layout_column="2"
212212
android:layout_rowSpan="8"

core/res/res/layout/keyguard_screen_password_portrait.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@
195195

196196
<!-- Area to overlay FaceLock -->
197197
<TextView android:id="@+id/faceLockAreaView"
198-
android:visibility="gone"
198+
android:visibility="invisible"
199199
android:layout_row="3"
200200
android:layout_column="0"
201201
android:layout_rowSpan="2"

core/res/res/layout/keyguard_screen_unlock_landscape.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162

163163
<!-- Area to overlay FaceLock -->
164164
<TextView android:id="@+id/faceLockAreaView"
165-
android:visibility="gone"
165+
android:visibility="invisible"
166166
android:layout_row="0"
167167
android:layout_column="1"
168168
android:layout_rowSpan="7"

core/res/res/layout/keyguard_screen_unlock_portrait.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174

175175
<!-- Area to overlay FaceLock -->
176176
<TextView android:id="@+id/faceLockAreaView"
177-
android:visibility="gone"
177+
android:visibility="invisible"
178178
android:layout_row="4"
179179
android:layout_column="0"
180180
android:layout_rowSpan="1"

policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,14 +1140,25 @@ public int getMinimumHeight() {
11401140

11411141
// Everything below pertains to FaceLock - might want to separate this out
11421142

1143-
// Only pattern and pin unlock screens actually have a view for the FaceLock area, so it's not
1144-
// uncommon for it to not exist. But if it does exist, we need to make sure it's shown (hiding
1145-
// the fallback) if FaceLock is enabled, and make sure it's hidden (showing the unlock) if
1146-
// FaceLock is disabled
1143+
// Take care of FaceLock area when layout is created
11471144
private void initializeFaceLockAreaView(View view) {
1148-
mFaceLockAreaView = view.findViewById(R.id.faceLockAreaView);
1149-
if (mFaceLockAreaView == null) {
1150-
if (DEBUG) Log.d(TAG, "Layout does not have faceLockAreaView");
1145+
if (mLockPatternUtils.usingBiometricWeak() &&
1146+
mLockPatternUtils.isBiometricWeakInstalled()) {
1147+
mFaceLockAreaView = view.findViewById(R.id.faceLockAreaView);
1148+
if (mFaceLockAreaView == null) {
1149+
Log.e(TAG, "Layout does not have faceLockAreaView and FaceLock is enabled");
1150+
} else {
1151+
if (mBoundToFaceLockService) {
1152+
// If we are creating a layout when we are already bound to FaceLock, then we
1153+
// are undergoing an orientation change. Stop FaceLock and restart it in the
1154+
// new location.
1155+
if (DEBUG) Log.d(TAG, "Restarting FL - creating view while already bound");
1156+
stopAndUnbindFromFaceLock();
1157+
activateFaceLockIfAble();
1158+
}
1159+
}
1160+
} else {
1161+
mFaceLockAreaView = null; // Set to null if not using FaceLock
11511162
}
11521163
}
11531164

@@ -1164,7 +1175,7 @@ public boolean handleMessage(Message msg) {
11641175
break;
11651176
case MSG_HIDE_FACELOCK_AREA_VIEW:
11661177
if (mFaceLockAreaView != null) {
1167-
mFaceLockAreaView.setVisibility(View.GONE);
1178+
mFaceLockAreaView.setVisibility(View.INVISIBLE);
11681179
}
11691180
break;
11701181
default:
@@ -1200,7 +1211,8 @@ private void showFaceLockAreaWithTimeout(long timeoutMillis) {
12001211
mHandler.sendEmptyMessageDelayed(MSG_HIDE_FACELOCK_AREA_VIEW, timeoutMillis);
12011212
}
12021213

1203-
// Binds to FaceLock service, but does not tell it to start
1214+
// Binds to FaceLock service. This call does not tell it to start, but it causes the service
1215+
// to call the onServiceConnected callback, which then starts FaceLock.
12041216
public void bindToFaceLock() {
12051217
if (mLockPatternUtils.usingBiometricWeak() &&
12061218
mLockPatternUtils.isBiometricWeakInstalled()) {
@@ -1236,9 +1248,10 @@ public void stopAndUnbindFromFaceLock() {
12361248
if (DEBUG) Log.d(TAG, "after unbind from FaceLock service");
12371249
mBoundToFaceLockService = false;
12381250
} else {
1239-
// This could probably happen after the session when someone activates FaceLock
1240-
// because it wasn't active when the phone was turned on
1241-
Log.w(TAG, "Attempt to unbind from FaceLock when not bound");
1251+
// This is usually not an error when this happens. Sometimes we will tell it to
1252+
// unbind multiple times because it's called from both onWindowFocusChanged and
1253+
// onDetachedFromWindow.
1254+
if (DEBUG) Log.d(TAG, "Attempt to unbind from FaceLock when not bound");
12421255
}
12431256
}
12441257
}

0 commit comments

Comments
 (0)