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
This commit is contained in:
xiaocheng.x.wang
2016-08-23 13:53:47 +08:00
committed by takeshi tanigawa
parent 176c0c5d98
commit 7602e88504

View File

@@ -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) {