What’s deprecated in Android Framework 2019
매년 사라져가는 Android API를 기념하여 글을 작성합니다.
2019년에는 Android 10 (Q)로 OS가 업데이트되었습니다.
이와 동시에 내년의 Android R도 개발 중입니다.
한해 동안 어떤 Framework API가 Deprecated 되었을지 간단히 살펴봅시다.
API diff는 이미지로 첨부합니다.
Hidden API 변경은 다루지 않습니다.
Core
가장 중요한 Deprecated 입니다.
Deprecate AsyncTask 📌
AsyncTask
는 더이상 유지보수되지 않습니다.java.util.concurrent
패키지를 사용하거나,
코틀린은 Kotlin concurrency utilities를 사용하는 것을 권장합니다.
Deprecate AliasActivity
오해할 수 있지만, 다행히 <activity-alias>
는 계속 사용할 수 있습니다.
아래와 같은 형태로 alias <meta-data>
를 사용하는 부분이 있다면,<activity-alias>
로 전환하는 것을 권장합니다.
Deprecate account-specific activity subclass
필요한 경우에는 AppCompatActivity
를 상속하여, 직접 구현해야 합니다.
Deprecate implicit Handler constructors 📌
Looper가 자동으로 지정될 수 있어서, 간혹 개발자 실수가 있었는데요.
이제는 Deprecated 되었습니다.
아래처럼 항상 명시적으로 Handler의 Looper를 설정해줘야 합니다.
Deprecate Looper.prepareMainLooper
또한 앱에서 Looper.prepareMainLooper()
를 호출할 수 없습니다.
Deprecate TimingLogger
성능 측정이 필요하면 android.os.Trace
혹은 Android Studio를 이용하세요.
Deprecate ListActivity and ExpandableListActivity
Platform API는 Compatibility를 보장할 수 없습니다.
이 기능은 이미 Compatibility를 보장하는 좋은 Component가 있으므로,
RecyclerView 등으로 전환하는 것이 좋습니다.
Deprecate IntentService 📌
이제는 WorkManager 혹은 JobIntentService를 사용하도록 변경해야 합니다.
Telephony
Deprecate some system apis in TelephonyManager
Deprecate Duplicate SignalStrength Methods
technology-specific getters는 Deprecated 됩니다.SignalStrength#getCellSignalStrengths()
을 사용할 것.
Deprecate acceptRingingCall and endCall.
CallScreeningService 혹은 InCallService로 대체 가능합니다.
Deprecate getNetworkType
TelephonyManager#getDataNetworkType()
와 기능이 중복됩니다.
Deprecate redundant IMS APIs in TelephonyManager.
ImsMmTelManager
API로 대체 가능합니다.
Rename and publicize getMaxPhoneCount; and deprecate getPhoneCount.
getPhoneCount
/ getMaxPhoneCount
대신getActiveModemCount
/ getSupportedModemCount
로 이름을 변경합니다.
deprecate KEY_CARRIER_FORCE_DISABLE_ETWS_CMAS_TEST_BOOL
Connectivity
Deprecate NetworkInfo
이전에는 네트워크 상태를 확인하려면 주기적으로 polling해야 했습니다.
Q부터는 더이상 NetworkInfo를 지원하지 않습니다.
필요한 경우, ConnectivityManager.NetworkCallback
를 사용하거나getNetworkCapabilities()
/ getLinkProperties()
API를 사용해야 합니다.
Deprecate getActiveLinkProperties.
NFC
Deprecate Android beam APIs
Android beam API를 지원하지 않습니다. (NFC Tag는 여전히 지원합니다.)
Bluetooth
Deprecate BluetoothHealth APIs
배터리 소모량을 최소화하려고 Deprecated 된 것 같습니다.
BLE API를 사용하는 것을 권장하고 있습니다.
Calendar
Deprecate JapaneseCalendar.CURRENT_ERA
일본에는 MEIJI, TAISHO, SHOWA, HEISEI 와 같은 연호 개념이 있습니다.
2019년 5월부터는 새로운 연호로 변경되었는데요. (Reiwa)
이로 인해 이전 OS 단말에서 잘못된 날짜로 표기될 수 있습니다.
따라서 플랫폼 API를 사용하지 않게끔 Deprecated 되었습니다.
Deprecate incorrect year constant
DateUtils.YEAR_IN_MILLIS
는 364일로, 실제 년도의 ms와 다릅니다.
상수 값을 사용하지 말고, 아래의 API를 사용하는 것이 정확합니다.
java.util.concurrent.TimeUnit
java.util.Calendar
java.time.Duration
그 밖에 중요하지 않아 보이는 것들…
실수로 Public으로 노출된 API 등등 Deprecated 되었습니다.
Deprecate SSLCertificateSocketFactory
Deprecate BreakIterator.getTitleInstance() functions and KIND_TITLE field
Deprecate ref… methods in MethodHandleInfo
Deprecate SystemApi that was accidently made public in P
Deprecate FileUtils.closeQuietly
Deprecate LoginFilter
Deprecate AlteredCharSequence
지금까지 2019년에 Deprecated된 Android Framework API를 살펴봤습니다.다른 것보다는 AsyncTask와 IntentService에 특히 영향 받을 것 같은데요.
다행히 Android 10은 적용되지 않았고, 내년도 R부터 적용될 것 같습니다.
프로젝트에 따라 RxJava, Coroutines, WorkManager, JobIntentService 등 적절한 방법을 선택해서 Migration하셔야 할 것 같습니다. 🤣
내년에도 재미있을 만한 내용으로 돌아오겠습니다.
그럼 즐거운 연말되세요. 🎉🎉🎉