From 7602e885042d44a15056ab55f65bb5e2fd965017 Mon Sep 17 00:00:00 2001 From: "xiaocheng.x.wang" Date: Tue, 23 Aug 2016 13:53:47 +0800 Subject: [PATCH] Fix apn can't be updated when pressing back key APN can't be updated because onkey() method is not invoked when user presses the virtual back key. The ApnEditor was changed from Activity to Fragment in Android N. A fragment can't receive onKey() event without calling setFocusableInTouchMode(true). Test: manual - updated apn setting, then pressed back Bug: 32815214 Change-Id: I7824e84bd617d2057a61f4198fa7fd50f123bc8e --- src/com/android/settings/ApnEditor.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/com/android/settings/ApnEditor.java b/src/com/android/settings/ApnEditor.java index 8a397f110ea..9a5fea18600 100644 --- a/src/com/android/settings/ApnEditor.java +++ b/src/com/android/settings/ApnEditor.java @@ -587,6 +587,8 @@ public class ApnEditor extends SettingsPreferenceFragment public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); view.setOnKeyListener(this); + view.setFocusableInTouchMode(true); + view.requestFocus(); } public boolean onKey(View v, int keyCode, KeyEvent event) {