काम करने के तरीके में बदलाव: Android 17 या इसके बाद के वर्शन को टारगेट करने वाले ऐप्लिकेशन

Android 17 में, पिछले वर्शन की तरह ही, कुछ ऐसे बदलाव किए गए हैं जिनसे आपके ऐप्लिकेशन पर असर पड़ सकता है. बर्ताव में किए गए ये बदलाव, सिर्फ़ Android 17 या इसके बाद के वर्शन को टारगेट करने वाले ऐप्लिकेशन पर लागू होते हैं. अगर आपका ऐप्लिकेशन, Android 17 या इसके बाद के वर्शन को टारगेट करता है, तो आपको अपने ऐप्लिकेशन में बदलाव करके, इन बदलावों के मुताबिक बनाना होगा.

बर्ताव में किए गए उन बदलावों की सूची भी देखें जो Android 17 पर चलने वाले सभी ऐप्लिकेशन पर लागू होते हैं. भले ही, आपके ऐप्लिकेशन का targetSdkVersion कुछ भी हो.

मुख्य फ़ंक्शन

Android 17 में, ये बदलाव किए गए हैं. इनसे Android सिस्टम की कई मुख्य क्षमताओं में बदलाव होता है या वे बेहतर होती हैं.

MessageQueue का नया लॉक-फ़्री वर्शन

Android 17 से, Android 17 (एपीआई लेवल 37) या इसके बाद के वर्शन को टारगेट करने वाले ऐप्लिकेशन को android.os.MessageQueue का नया लॉक-फ़्री वर्शन मिलता है. इस नई सुविधा को लागू करने से, परफ़ॉर्मेंस बेहतर होती है और छूटे हुए फ़्रेम की संख्या कम होती है. हालांकि, इससे MessageQueue प्राइवेट फ़ील्ड और तरीकों पर असर डालने वाले क्लाइंट पर असर पड़ सकता है.

ज़्यादा जानकारी और समस्या को कम करने की रणनीतियों के लिए, MessageQueue के व्यवहार में हुए बदलाव से जुड़े दिशा-निर्देश देखें.

स्टैटिक फ़ाइनल फ़ील्ड में अब बदलाव नहीं किया जा सकता

Apps running on Android 17 or higher that target Android 17 (API level 37) or higher cannot change static final fields. If an app attempts to change a static final field by using reflection, it will cause an IllegalAccessException. Attempting to modify one of these fields through JNI APIs (such as SetStaticLongField()) will cause the app to crash.

सुलभता

Android 17 में, सुलभता को बेहतर बनाने के लिए ये बदलाव किए गए हैं.

कॉम्प्लेक्स IME फ़िज़िकल कीबोर्ड टाइपिंग के लिए सुलभता की सुविधा

This feature introduces new AccessibilityEvent and TextAttribute APIs to enhance screen reader spoken feedback for CJKV language input. CJKV IME apps can now signal whether a text conversion candidate has been selected during text composition. Apps with edit fields can specify text change types when sending text changed accessibility events. For example, apps can specify that a text change occurred during text composition, or that a text change resulted from a commit. Doing this enables accessibility services such as screen readers to deliver more precise feedback based on the nature of the text modification.

App adoption

  • IME Apps: When setting composing text in edit fields, IMEs can use TextAttribute.Builder.setTextSuggestionSelected() to indicate whether a specific conversion candidate was selected.

  • Apps with Edit Fields: Apps that maintain a custom InputConnection can retrieve candidate selection data by calling TextAttribute.isTextSuggestionSelected(). These apps should then call AccessibilityEvent.setTextChangeTypes() when dispatching TYPE_VIEW_TEXT_CHANGED events. Apps targeting Android 17 (API level 37) that use the standard TextView will have this feature enabled by default. (That is, TextView will handle retrieving data from the IME and setting text change types when sending events to accessibility services).

  • Accessibility Services: Accessibility services that process TYPE_VIEW_TEXT_CHANGED events can call AccessibilityEvent.getTextChangeTypes() to identify the nature of the modification and adjust their feedback strategies accordingly.

निजता

Android 17 में, लोगों की निजता को बेहतर बनाने के लिए ये बदलाव किए गए हैं.

ECH (Encrypted Client Hello) की सुविधा चालू की गई

Android 17 में, एन्क्रिप्ट (सुरक्षित) किए गए Client Hello (ECH) के लिए प्लैटफ़ॉर्म की सुविधा जोड़ी गई है. यह TLS का एक एक्सटेंशन है. इससे, TLS हैंडशेक में Server Name Indication (SNI) को एन्क्रिप्ट (सुरक्षित) करके, उपयोगकर्ता की निजता को बेहतर बनाया जाता है. इस एन्क्रिप्ट (सुरक्षित) करने की सुविधा से, नेटवर्क पर नज़र रखने वाले लोगों को यह आसानी से पता नहीं चल पाता कि आपका ऐप्लिकेशन किस डोमेन से कनेक्ट हो रहा है.

Android 17 (एपीआई लेवल 37) या इसके बाद के वर्शन को टारगेट करने वाले ऐप्लिकेशन के लिए, TLS कनेक्शन के लिए ECH का इस्तेमाल किया जाता है. ECH सिर्फ़ तब काम करता है, जब ऐप्लिकेशन के लिए इस्तेमाल की जा रही नेटवर्किंग लाइब्रेरी (उदाहरण के लिए, HttpEngine, WebView या OkHttp) में ECH की सुविधा इंटिग्रेट की गई हो और रिमोट सर्वर भी ECH प्रोटोकॉल के साथ काम करता हो. अगर ECH को नेगोशिएट नहीं किया जा सकता, तो क्लाइंट, ECH एक्सटेंशन को रैंडमाइज़्ड कॉन्टेंट के साथ भेजता है. इसे ECH GREASE कहा जाता है. ECH GREASE के काम करने के तरीके के बारे में ज़्यादा जानने के लिए, RFC 9849 देखें.

ऐप्लिकेशन को इस व्यवहार को पसंद के मुताबिक बनाने की अनुमति देने के लिए, Android 17 में Network Security Configuration फ़ाइल में एक नया <domainEncryption> एलिमेंट जोड़ा गया है. डेवलपर, <base-config> या <domain-config> टैग में <domainEncryption> का इस्तेमाल करके, ग्लोबल या हर डोमेन के हिसाब से ECH मोड चुन सकते हैं. उदाहरण के लिए, "enabled" या "disabled".

ज़्यादा जानकारी के लिए, एन्क्रिप्ट (सुरक्षित) किए गए Client Hello से जुड़ा दस्तावेज़ देखें.

Android 17 को टारगेट करने वाले ऐप्लिकेशन के लिए, लोकल नेटवर्क की अनुमति ज़रूरी है

Android 17 में, ACCESS_LOCAL_NETWORK रनटाइम अनुमति की सुविधा जोड़ी गई है. इससे, उपयोगकर्ताओं को लोकल नेटवर्क के अनधिकृत ऐक्सेस से बचाया जा सकता है. यह अनुमति, NEARBY_DEVICES अनुमति वाले मौजूदा ग्रुप में शामिल है. इसलिए, जिन उपयोगकर्ताओं ने पहले ही NEARBY_DEVICES की अन्य अनुमतियां दी हैं उन्हें फिर से अनुमति देने के लिए नहीं कहा जाएगा. इस नई ज़रूरत के तहत, नुकसान पहुंचाने वाले ऐप्लिकेशन को लोकल नेटवर्क के अनचाहे ऐक्सेस का गलत इस्तेमाल करके, उपयोगकर्ताओं को ट्रैक करने और उनकी पहचान चुराने से रोका जा सकता है. इस अनुमति के बारे में जानकारी देकर और इसके लिए अनुरोध करके, आपका ऐप्लिकेशन लोकल एरिया नेटवर्क (एलएएन) पर मौजूद डिवाइसों को खोज सकता है और उनसे कनेक्ट हो सकता है. जैसे, स्मार्ट होम डिवाइस या कास्टिंग रिसीवर.

Android 17 (एपीआई लेवल 37) या इसके बाद के वर्शन को टारगेट करने वाले ऐप्लिकेशन के पास, एलएएन डिवाइसों से संपर्क बनाए रखने के दो तरीके हैं: अनुमति के लिए प्रॉम्प्ट को स्किप करने के लिए, सिस्टम-मीडिएटेड और निजता बनाए रखने वाले डिवाइस पिकर का इस्तेमाल करें या लोकल नेटवर्क पर संपर्क बनाए रखने के लिए, रनटाइम में इस नई अनुमति के लिए साफ़ तौर पर अनुरोध करें.

ज़्यादा जानकारी के लिए, लोकल नेटवर्क की अनुमति से जुड़ा दस्तावेज़ देखें.

फ़िज़िकल डिवाइसों से पासवर्ड छिपाना

If an app targets Android 17 (API level 37) or higher and the user is using a physical input device (for example, an external keyboard), the Android operating system applies the new show_passwords_physical setting to all characters in the password field. By default, that setting hides all password characters.

The Android system shows the last-typed password character to help the user see if they mistyped the password. However, this is much less necessary with larger external keyboards. In addition, devices with external keyboards often have larger displays, which increases the danger of someone seeing the typed password.

If the user is using the device's touchscreen, the system applies the new show_passwords_touch setting.

एसएमएस के स्टैंडर्ड मैसेज के लिए, ओटीपी की सुरक्षा

Beginning with Android 17, Android is extending its SMS OTP protection to apply to standard SMS messages (SMS messages containing an OTP that do not use the WebOTP or SMS Retriever formats). For most apps targeting Android 17 (API level 37) or higher, these SMS messages do not become available until three hours after receipt. This delay is intended to help prevent OTP hijacking. During this three hour delay, the SMS_RECEIVED_ACTION broadcast is withheld and SMS provider database queries are filtered. The SMS message is available to these apps after the delay.

Certain apps such as the default SMS assistant app, connected device companion apps, etc., are exempted from this delay. All apps that rely on reading SMS messages for OTP extraction should transition to using SMS Retriever or SMS User Consent APIs to ensure continued functionality.

सुरक्षा

Android 17 में, डिवाइस और ऐप्लिकेशन की सुरक्षा को बेहतर बनाने के लिए ये बदलाव किए गए हैं.

ऐक्टिविटी की सुरक्षा

In Android 17, the platform continues its shift toward a "secure-by-default" architecture, introducing a suite of enhancements designed to mitigate high-severity exploits such as phishing, interaction hijacking, and confused deputy attacks. This update requires developers to explicitly opt in to new security standards to maintain app compatibility and user protection.

Key impacts for developers include:

  • BAL hardening & improved opt-in: We are refining Background Activity Launch (BAL) restrictions by extending protections to IntentSender. Developers must migrate away from the legacy MODE_BACKGROUND_ACTIVITY_START_ALLOWED constant. Instead, you should adopt granular controls like MODE_BACKGROUND_ACTIVITY_START_ALLOW_IF_VISIBLE, which restricts activity starts to scenarios where the calling app is visible, significantly reducing the attack surface.
  • Adoption tools: Developers should utilize strict mode and updated lint checks to identify legacy patterns and ensure readiness for future target SDK requirements.

CT को डिफ़ॉल्ट रूप से चालू करना

If an app targets Android 17 (API level 37) or higher, certificate transparency (CT) is enabled by default. (On Android 16, CT is available but apps had to opt in.)

Native DCL—C को ज़्यादा सुरक्षित बनाना

If your app targets Android 17 (API level 37) or higher, the Safer Dynamic Code Loading (DCL) protection introduced in Android 14 for DEX and JAR files now extends to native libraries.

All native files loaded using System.load() must be marked as read-only. Otherwise, the system throws UnsatisfiedLinkError.

We recommend that apps avoid dynamically loading code whenever possible, as doing so greatly increases the risk that an app can be compromised by code injection or code tampering.

CP2 के डेटा व्यू में, व्यक्तिगत पहचान से जुड़ी जानकारी फ़ील्ड पर पाबंदी लगाना

Android 17 (एपीआई लेवल Android 17 (एपीआई लेवल 37)) और इससे ऊपर के वर्शन को टारगेट करने वाले ऐप्लिकेशन के लिए, Contacts Provider 2 (CP2), डेटा व्यू में व्यक्तिगत पहचान से जुड़ी जानकारी (पीआईआई) वाले कुछ कॉलम को प्रतिबंधित करता है. इस बदलाव को चालू करने पर, उपयोगकर्ता की निजता को बेहतर बनाने के लिए, इन कॉलम को डेटा व्यू से हटा दिया जाता है. पाबंदी वाले कॉलम में ये शामिल हैं:

ContactsContract.Data से इन कॉलम का इस्तेमाल करने वाले ऐप्लिकेशन, ContactsContract.RawContacts से इन्हें निकाल सकते हैं. इसके लिए, उन्हें RAW_CONTACT_ID से जुड़ना होगा.

CP2 में, एसक्यूएल की सख्त जांच लागू करना

Android 17 (एपीआई लेवल Android 17 (एपीआई लेवल 37)) और इसके बाद के वर्शन को टारगेट करने वाले ऐप्लिकेशन के लिए, Contacts Provider 2 (CP2), SQL क्वेरी की पुष्टि करने की सुविधा लागू करता है. ऐसा तब होता है, जब ContactsContract.Data टेबल को READ_CONTACTS अनुमति के बिना ऐक्सेस किया जाता है.

इस बदलाव के बाद, अगर किसी ऐप्लिकेशन के पास READ_CONTACTS की अनुमति नहीं है, तो ContactsContract.Data टेबल से क्वेरी करते समय, StrictColumns और StrictGrammar विकल्प सेट किए जाते हैं. अगर कोई क्वेरी ऐसे पैटर्न का इस्तेमाल करती है जो इनके साथ काम नहीं करता है, तो उसे अस्वीकार कर दिया जाएगा. साथ ही, इसकी वजह से एक अपवाद भी जनरेट होगा.

मीडिया

Android 17 में, मीडिया के बर्ताव में ये बदलाव किए गए हैं.

बैकग्राउंड में ऑडियो चलाने की सुविधा को ज़्यादा सुरक्षित बनाना

Beginning with Android 17, the audio framework enforces restrictions on background audio interactions including audio playback, audio focus requests, and volume change APIs to ensure that these changes are started intentionally by the user.

Some audio restrictions apply to all apps. However, the restrictions are more stringent if an app targets Android 17 (API level 37). If one of these apps interacts with audio while it is in the background, it must have a foreground service running. In addition, the app must meet one or both of these requirements:

  • The foreground service must have while-in-use (WIU) capabilities.
  • The app must have the exact alarm permission and be interacting with USAGE_ALARM audio streams.

For more information, including mitigation strategies, see Background audio hardening.

डिवाइसों के नाप या आकार

Android 17 में, डिवाइसों के अलग-अलग साइज़ और नाप या आकार के हिसाब से, लोगों के अनुभव को बेहतर बनाने के लिए ये बदलाव किए गए हैं.

बड़े स्क्रीन वाले डिवाइसों (sw>=600dp) पर, स्क्रीन की दिशा, साइज़ बदलने, और आसपेक्ट रेशियो (लंबाई-चौड़ाई का अनुपात) से जुड़ी पाबंदियों को अनदेखा करने के लिए, प्लैटफ़ॉर्म एपीआई में बदलाव

हमने Android 16 में प्लैटफ़ॉर्म एपीआई में बदलाव किए हैं. इससे, एपीआई लेवल 36 या इसके बाद के वर्शन को टारगेट करने वाले ऐप्लिकेशन के लिए, बड़ी स्क्रीन (sw >= 600dp) पर ओरिएंटेशन, आसपेक्ट रेशियो, और साइज़ बदलने से जुड़ी पाबंदियों को अनदेखा किया जा सकेगा. डेवलपर के पास एसडीके 36 का इस्तेमाल करके, इन बदलावों से ऑप्ट आउट करने का विकल्प है. हालांकि, Android 17 (एपीआई लेवल 37) या इसके बाद के वर्शन को टारगेट करने वाले ऐप्लिकेशन के लिए, ऑप्ट-आउट करने का यह विकल्प उपलब्ध नहीं होगा.

ज़्यादा जानकारी के लिए, ओरिएंटेशन और साइज़ बदलने से जुड़ी पाबंदियों को अनदेखा किया जाता है लेख पढ़ें.

कनेक्टिविटी

Android 17 में, ब्लूटूथ RFCOMM सॉकेट के लिए, स्टैंडर्ड Java InputStream के बर्ताव के मुताबिक बनाने और एक जैसा अनुभव देने के लिए, यह बदलाव किया गया है.

RFCOMM के लिए, BluetoothSocket read() का एक जैसा बर्ताव

Android 17 (एपीआई लेवल 37) को टारगेट करने वाले ऐप्लिकेशन के लिए, InputStream से मिले RFCOMM पर आधारित BluetoothSocket का read() तरीका अब सॉकेट बंद होने या कनेक्शन ड्रॉप होने पर -1 दिखाता है.

इस बदलाव से, RFCOMM सॉकेट का व्यवहार LE CoC सॉकेट के जैसा हो जाता है. साथ ही, यह InputStream.read() दस्तावेज़ के मुताबिक होता है. इसमें बताया गया है कि स्ट्रीम के खत्म होने पर -1 दिखता है.

जो ऐप्लिकेशन, रीड लूप से बाहर निकलने के लिए सिर्फ़ IOException को पकड़ने पर निर्भर होते हैं उन पर इस बदलाव का असर पड़ सकता है. इसलिए, उन्हें BluetoothSocket के रीड लूप को अपडेट करना चाहिए, ताकि -1 की रिटर्न वैल्यू की साफ़ तौर पर जांच की जा सके. इससे यह पक्का होता है कि रिमोट डिवाइस के डिसकनेक्ट होने या सॉकेट के बंद होने पर, लूप सही तरीके से खत्म हो जाए. सुझाई गई प्रोसेस के उदाहरण के लिए, ब्लूटूथ से डेटा ट्रांसफ़र करने की गाइड में दिया गया कोड स्निपेट देखें.