OSDN Git Service

Refactor to remove multiple in-loop Object[]->String[] castings
authorBen Clark <benbread@gmail.com>
Tue, 27 Jul 2010 15:20:59 +0000 (16:20 +0100)
committerBen Clark <benbread@gmail.com>
Thu, 29 Jul 2010 19:51:31 +0000 (20:51 +0100)
commit0008d219a2964218477d5bd5f28a848844063c44
tree9c646b1b0ada80d8761ca95916abfd3a568673a0
parent46c0a5b12973fcd40b72b48fe344e45f1110865e
Refactor to remove multiple in-loop Object[]->String[] castings

(This replaces Iaa0f3b25eaadb094a4c3fb4cecbd09e0322aae33)

This change removes the need to convert Object[]->String[] for each iteration
of each of available,tethered,errored states in updateStatus()
by converting these as soon as possible.

This fix (and the code before) is strange because each of available,tethered,
errored are defined as type ArrayList<String> but
intent.getStringArrayListExtra() returns type Object[] dispite its name.
Because other calls to updateState() use String[] it seems best to do the
conversion outside this method in the Object[] case and thus avoid the
per-iteration casting in the Object[] case and the downright wasteful
per-iteration String[]->Object[]->String[] casting in the String[] input cases.

I've also removed some unused imports and an unused variable.

Change-Id: I805ef19aa9ceff7e4fc491623cdcb413ce170798
src/com/android/settings/TetherSettings.java