ऐप्लिकेशन के व्यवहार में बदलाव: सभी ऐप्लिकेशन

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

Android 15 को टारगेट करने वाले ऐप्लिकेशन पर असर डालने वाले बदलावों की सूची भी ज़रूर देखें.

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

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

पैकेज के बंद होने की स्थिति में बदलाव

पैकेज FLAG_STOPPED की स्थिति का मकसद, ऐप्लिकेशन को तब तक इस स्थिति में रखना है, जब तक उपयोगकर्ता सीधे तौर पर ऐप्लिकेशन को लॉन्च करके या शेयरशीट या विजेट के ज़रिए ऐप्लिकेशन के साथ इंटरैक्ट करके (ऐप्लिकेशन को लाइव वॉलपेपर के तौर पर चुनना वगैरह) ऐप्लिकेशन को इस स्थिति से हटा न दे. उपयोगकर्ता, AOSP बिल्ड में ऐप्लिकेशन आइकॉन को दबाकर रखकर और "ज़बरदस्ती बंद करें" को चुनकर, पैकेज FLAG_STOPPED की स्थिति में ऐप्लिकेशन को डाल सकता है. Android 15 में, हमने सिस्टम के व्यवहार को अपडेट किया है, ताकि यह इस मकसद के मुताबिक काम करे. ऐप्लिकेशन को 'रोका गया' स्थिति से सिर्फ़ तब हटाया जाना चाहिए, जब उपयोगकर्ता ने सीधे तौर पर या किसी अन्य तरीके से ऐसा किया हो.

ऐप्लिकेशन को Android 15 वाले डिवाइस पर बंद होने पर, सिस्टम सभी मंज़ूरी बाकी इंटेंट को रद्द कर देता है. ऐसा, ऐप्लिकेशन के सही तरीके से काम करने के लिए, मौजूदा पाबंदियों के साथ-साथ किया जाता है. जब उपयोगकर्ता की कार्रवाइयों से ऐप्लिकेशन को 'बंद है' स्थिति से हटाया जाता है, तो ऐप्लिकेशन पर ACTION_BOOT_COMPLETED ब्रॉडकास्ट डिलीवर किया जाता है. इससे, किसी भी लंबित इंटेंट को फिर से रजिस्टर करने का मौका मिलता है.

ऐप्लिकेशन को बंद किया गया है या नहीं, इसकी पुष्टि करने के लिए, नए ApplicationStartInfo.wasForceStopped() तरीके का इस्तेमाल किया जा सकता है.

16 केबी वाले पेज साइज़ के साथ काम करने की सुविधा

Android पर, अब तक सिर्फ़ 4 केबी मेमोरी वाले पेज साइज़ का इस्तेमाल किया जा सकता था. इससे, Android डिवाइसों में आम तौर पर मौजूद कुल मेमोरी के लिए, सिस्टम मेमोरी की परफ़ॉर्मेंस को ऑप्टिमाइज़ किया जाता था. Android 15 से, AOSP उन डिवाइसों के साथ काम करता है जिन्हें 16 केबी (16 केबी डिवाइस) के पेज साइज़ का इस्तेमाल करने के लिए कॉन्फ़िगर किया गया है. अगर आपका ऐप्लिकेशन, सीधे तौर पर या किसी SDK टूल के ज़रिए, NDK लाइब्रेरी का इस्तेमाल करता है, तो आपको अपने ऐप्लिकेशन को फिर से बनाना होगा, ताकि वह 16 केबी वाले डिवाइसों पर काम कर सके.

डिवाइस बनाने वाली कंपनियां, ज़्यादा फ़िज़िकल मेमोरी (रैम) वाले डिवाइस बना रही हैं. इसलिए, इनमें से कई डिवाइसों पर 16 केबी (और बाद में ज़्यादा) पेज साइज़ का इस्तेमाल किया जाएगा, ताकि डिवाइस की परफ़ॉर्मेंस को ऑप्टिमाइज़ किया जा सके. 16 केबी वाले पेज साइज़ वाले डिवाइसों के लिए, ऐप्लिकेशन को चलाने की सुविधा जोड़ने पर, आपका ऐप्लिकेशन इन डिवाइसों पर चल पाएगा. साथ ही, इससे आपके ऐप्लिकेशन की परफ़ॉर्मेंस में हुई सुधारों का फ़ायदा भी मिलेगा. फिर से कंपाइल किए बिना, ऐप्लिकेशन Android के आने वाले वर्शन में 16 KB वाले डिवाइसों पर काम नहीं करेंगे.

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

फ़ायदे और परफ़ॉर्मेंस में बढ़ोतरी

16 केबी वाले पेज साइज़ के साथ कॉन्फ़िगर किए गए डिवाइस औसतन थोड़ी ज़्यादा मेमोरी का इस्तेमाल करते हैं, लेकिन इससे सिस्टम और ऐप्लिकेशन, दोनों के लिए परफ़ॉर्मेंस में कई सुधार भी होते हैं:

  • सिस्टम में मेमोरी कम होने पर, ऐप्लिकेशन लॉन्च होने में लगने वाला समय कम हो गया है: औसतन 3.16% कम, जिन ऐप्लिकेशन की हमने जांच की है उनमें 30% तक का सुधार हुआ है
  • ऐप्लिकेशन के लॉन्च के दौरान, पावर सप्लाई में कमी: औसतन 4.56% की कमी
  • कैमरे को तेज़ी से लॉन्च करने की सुविधा: औसतन 4.48% ज़्यादा तेज़ी से हॉट स्टार्ट और 6.60% ज़्यादा तेज़ी से कोल्ड स्टार्ट
  • सिस्टम बूट होने का समय बेहतर हुआ: औसतन 8% (करीब 950 मिलीसेकंड) की बढ़ोतरी हुई

ये सुधार, हमारी शुरुआती जांच पर आधारित हैं. इसलिए, हो सकता है कि असल डिवाइसों पर नतीजे अलग हों. जैसे-जैसे हम अपनी टेस्टिंग को जारी रखेंगे, वैसे-वैसे हम ऐप्लिकेशन को मिलने वाले संभावित फ़ायदों का अतिरिक्त विश्लेषण देंगे.

देखें कि आपके ऐप्लिकेशन पर इसका असर पड़ा है या नहीं

अगर आपका ऐप्लिकेशन किसी नेटिव कोड का इस्तेमाल करता है, तो आपको अपने ऐप्लिकेशन को 16 केबी वाले डिवाइसों के लिए फिर से बनाना होगा. अगर आपको नहीं पता कि आपका ऐप्लिकेशन नेटिव कोड का इस्तेमाल करता है या नहीं, तो APK विश्लेषक का इस्तेमाल करके यह पता लगाया जा सकता है कि कोई नेटिव कोड मौजूद है या नहीं. इसके बाद, आपको जो शेयर की गई लाइब्रेरी मिलती हैं उनके ELF सेगमेंट के अलाइनमेंट की जांच करें. Android Studio में ऐसी सुविधाएं भी होती हैं जिनकी मदद से, अलाइनमेंट से जुड़ी समस्याओं का पता अपने-आप चल जाता है.

अगर आपका ऐप्लिकेशन सिर्फ़ Java प्रोग्रामिंग भाषा या Kotlin में लिखे गए कोड का इस्तेमाल करता है, तो इसका मतलब है कि आपका ऐप्लिकेशन पहले से ही 16 केबी वाले डिवाइसों पर काम करता है. इसमें सभी लाइब्रेरी या SDK टूल भी शामिल हैं. इसके बावजूद, हमारा सुझाव है कि आप अपने ऐप्लिकेशन को 16 केबी वाले एनवायरमेंट में टेस्ट करें. इससे यह पक्का किया जा सकेगा कि ऐप्लिकेशन के काम करने के तरीके में कोई अनचाहा बदलाव नहीं हुआ है.

प्राइवेट स्पेस की सुविधा के साथ काम करने के लिए, कुछ ऐप्लिकेशन में ज़रूरी बदलाव

Private space is a new feature in Android 15 that lets users create a separate space on their device where they can keep sensitive apps away from prying eyes, under an additional layer of authentication. Because apps in the private space have restricted visibility, some types of apps need to take additional steps to be able to see and interact with apps in a user's private space.

All apps

Because apps in the private space are kept in a separate user profile, similar to work profiles, apps shouldn't assume that any installed copies of their app that aren't in the main profile are in the work profile. If your app has logic related to work profile apps that make this assumption, you'll need to adjust this logic.

Medical apps

When a user locks the private space, all apps in the private space are stopped, and those apps can't perform foreground or background activities, including showing notifications. This behavior might critically impact the use and function of medical apps installed in the private space.

The private space setup experience warns users that the private space is not suitable for apps that need to perform critical foreground or background activities, such as showing notifications from medical apps. However, apps can't determine whether or not they're being used in the private space, so they can't show a warning to the user for this case.

For these reasons, if you develop a medical app, review how this feature might impact your app and take appropriate actions—such as informing your users not to install your app in the private space—to avoid disrupting critical app capabilities.

Launcher apps

If you develop a launcher app, you must do the following before apps in the private space will be visible:

  1. Your app must be assigned as the default launcher app for the device—that is, possessing the ROLE_HOME role.
  2. Your app must declare the ACCESS_HIDDEN_PROFILES normal permission in your app's manifest file.

Launcher apps that declare the ACCESS_HIDDEN_PROFILES permission must handle the following private space use cases:

  1. Your app must have a separate launcher container for apps installed in the private space. Use the getLauncherUserInfo() method to determine which type of user profile is being handled.
  2. The user must be able to hide and show the private space container.
  3. The user must be able to lock and unlock the private space container. Use the requestQuietModeEnabled() method to lock (by passing true) or unlock (by passing false) the private space.
  4. While locked, no apps in the private space container should be visible or discoverable through mechanisms such as search. Your app should register a receiver for the ACTION_PROFILE_AVAILABLE and ACTION_PROFILE_UNAVAILABLE broadcasts and update the UI in your app when the locked or unlocked state of the private space container changes. Both of these broadcasts include EXTRA_USER, which your app can use to refer to the private profile user.

    You can also use the isQuietModeEnabled() method to check whether the private space profile is locked or not.

App store apps

The private space includes an "Install Apps" button that launches an implicit intent to install apps into the user's private space. In order for your app to receive this implicit intent, declare an <intent-filter> in your app's manifest file with a <category> of CATEGORY_APP_MARKET.

PNG पर आधारित इमोजी फ़ॉन्ट हटाया गया

The legacy, PNG-based emoji font file (NotoColorEmojiLegacy.ttf) has been removed, leaving just the vector-based file. Beginning with Android 13 (API level 33), the emoji font file used by the system emoji renderer changed from a PNG-based file to a vector based file. The system retained the legacy font file in Android 13 and 14 for compatibility reasons, so that apps with their own font renderers could continue to use the legacy font file until they were able to upgrade.

To check if your app is affected, search your app's code for references to the NotoColorEmojiLegacy.ttf file.

You can choose to adapt your app in a number of ways:

  • Use platform APIs for text rendering. You can render text to a bitmap-backed Canvas and use that to get a raw image if necessary.
  • Add COLRv1 font support to your app. The FreeType open source library supports COLRv1 in version 2.13.0 and higher.
  • As a last resort, you can bundle the legacy emoji font file (NotoColorEmoji.ttf) into your APK, although in that case your app will be missing the latest emoji updates. For more information, see the Noto Emoji GitHub project page.

टारगेट किए गए एसडीके के कम से कम वर्शन को 23 से बढ़ाकर 24 किया गया

Android 15 builds on the the changes that were made in Android 14 and extends this security further. In Android 15, apps with a targetSdkVersion lower than 24 can't be installed. Requiring apps to meet modern API levels helps to ensure better security and privacy.

Malware often targets lower API levels in order to bypass security and privacy protections that have been introduced in higher Android versions. For example, some malware apps use a targetSdkVersion of 22 to avoid being subjected to the runtime permission model introduced in 2015 by Android 6.0 Marshmallow (API level 23). This Android 15 change makes it harder for malware to avoid security and privacy improvements. Attempting to install an app targeting a lower API level results in an installation failure, with a message like the following one appearing in Logcat:

INSTALL_FAILED_DEPRECATED_SDK_VERSION: App package must target at least SDK version 24, but found 7

On devices upgrading to Android 15, any apps with a targetSdkVersion lower than 24 remain installed.

If you need to test an app targeting an older API level, use the following ADB command:

adb install --bypass-low-target-sdk-block FILENAME.apk

सुरक्षा और निजता

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

डेवलपर को इन बातों का ध्यान रखना चाहिए, ताकि यह पक्का किया जा सके कि उनके ऐप्लिकेशन, Android 15 में किए गए बदलावों के साथ काम करते हों:

ओटीपी छिपाना

Android, NotificationListenerService को लागू करने वाले गैर-भरोसेमंद ऐप्लिकेशन को, सूचनाओं में मौजूद ओटीपी को छिपाए बिना पढ़ने से रोक देगा. भरोसेमंद ऐप्लिकेशन, जैसे कि साथी डिवाइस मैनेजर असोसिएशन को इन पाबंदियों से छूट मिली है.

स्क्रीन शेयर करने की सुविधा को सुरक्षित करना

  • स्क्रीन शेयर करने के दौरान, सूचनाओं का कॉन्टेंट छिपा दिया जाता है, ताकि उपयोगकर्ता की निजता को बनाए रखा जा सके. अगर ऐप्लिकेशन में setPublicVersion() लागू किया जाता है, तो Android सूचना का सार्वजनिक वर्शन दिखाता है. यह सूचना, असुरक्षित कॉन्टेक्स्ट में सूचना की जगह काम करती है. ऐसा न होने पर, सूचना के कॉन्टेंट को बिना किसी और जानकारी के बदल दिया जाता है.
  • पासवर्ड डालने जैसा संवेदनशील कॉन्टेंट, दर्शकों से छिपाकर रखा जाता है, ताकि उपयोगकर्ता की संवेदनशील जानकारी ज़ाहिर न हो.
  • स्क्रीन शेयर करने के दौरान, जिन ऐप्लिकेशन से सूचनाएं पोस्ट की जाती हैं और जिनमें ओटीपी का पता चलता है उनकी गतिविधियां छिपी होंगी. ऐप्लिकेशन लॉन्च करने पर, उसका कॉन्टेंट रिमोट व्यूअर से छिप जाता है.
  • Android, संवेदनशील फ़ील्ड की अपने-आप पहचान करता है. इसके अलावा, डेवलपर setContentSensitivity का इस्तेमाल करके, अपने ऐप्लिकेशन के कुछ हिस्सों को मैन्युअल तौर पर संवेदनशील के तौर पर मार्क कर सकते हैं. स्क्रीन शेयर करने के दौरान, ये हिस्से रीमोट दर्शकों से छिपे रहते हैं.
  • डेवलपर, डेवलपर के लिए विकल्प में जाकर, स्क्रीन शेयर करने से जुड़ी सुरक्षा सुविधाएं बंद करें विकल्प को टॉगल कर सकते हैं. इससे, डेमो या टेस्टिंग के लिए, स्क्रीन शेयर करने से जुड़ी सुरक्षा सुविधाओं से छूट मिलती है. डिफ़ॉल्ट सिस्टम स्क्रीन रिकॉर्डर को इन बदलावों से छूट मिली है, क्योंकि रिकॉर्डिंग डिवाइस पर ही सेव रहती हैं.

कैमरा और मीडिया

Android 15 में, सभी ऐप्लिकेशन के लिए कैमरे और मीडिया के व्यवहार में ये बदलाव किए गए हैं.

ऑडियो को सीधे तौर पर चलाने और ऑफ़लोड करने की सुविधा का इस्तेमाल करने पर, संसाधन की सीमाएं पूरी होने पर, सीधे तौर पर चलाए गए या ऑफ़लोड किए गए ऑडियो ट्रैक अमान्य हो जाते हैं

Before Android 15, if an app requested direct or offload audio playback while another app was playing audio and the resource limits were reached, the app would fail to open a new AudioTrack.

Beginning with Android 15, when an app requests direct or offload playback and the resource limits are reached, the system invalidates any currently open AudioTrack objects which prevent fulfilling the new track request.

(Direct and offload audio tracks are typically opened for playback of compressed audio formats. Common use-cases for playing direct audio include streaming encoded audio over HDMI to a TV. Offload tracks are typically used to play compressed audio on a mobile device with hardware DSP acceleration.)

उपयोगकर्ता अनुभव और सिस्टम यूज़र इंटरफ़ेस (यूआई)

Android 15 में कुछ ऐसे बदलाव किए गए हैं जिनसे उपयोगकर्ताओं को बेहतर और आसान अनुभव मिलेगा.

जिन ऐप्लिकेशन ने ऑप्ट-इन किया है उनके लिए, प्रिडिक्टिव बैक ऐनिमेशन की सुविधा चालू की गई है

Beginning in Android 15, the developer option for predictive back animations has been removed. System animations such as back-to-home, cross-task, and cross-activity now appear for apps that have opted in to the predictive back gesture either entirely or at an activity level. If your app is affected, take the following actions:

  • Ensure that your app has been properly migrated to use the predictive back gesture.
  • Ensure that your fragment transitions work with predictive back navigation.
  • Migrate away from animation and framework transitions and use animator and androidx transitions instead.
  • Migrate away from back stacks that FragmentManager doesn't know about. Use back stacks managed by FragmentManager or by the Navigation component instead.

जब कोई उपयोगकर्ता किसी ऐप्लिकेशन को ज़बरदस्ती बंद करता है, तब विजेट नहीं जोड़े जा सकते

If a user force-stops an app on a device running Android 15, the system temporarily disables all the app's widgets. The widgets are grayed out, and the user cannot interact with them. This is because beginning with Android 15, the system cancels all an app's pending intents when the app is force-stopped.

The system re-enables those widgets the next time the user launches the app.

For more information, see Changes to package stopped state.

मीडिया प्रोजेक्शन स्टेटस बार चिप, उपयोगकर्ताओं को स्क्रीन शेयर करने, कास्ट करने, और रिकॉर्ड करने के बारे में सूचनाएं देता है

स्क्रीन प्रोजेक्शन का गलत इस्तेमाल करने पर, उपयोगकर्ताओं का निजी डेटा, जैसे कि वित्तीय जानकारी ज़ाहिर हो जाती है. ऐसा इसलिए होता है, क्योंकि उपयोगकर्ताओं को पता नहीं चलता कि उनकी डिवाइस की स्क्रीन शेयर की जा रही है.

Android 15 QPR1 या इसके बाद के वर्शन वाले डिवाइसों पर चलने वाले ऐप्लिकेशन के लिए, स्टेटस बार में एक बड़ा और प्रमुख चिप दिखता है. इससे, उपयोगकर्ताओं को स्क्रीन प्रोजेक्शन के दौरान सूचना मिलती है. उपयोगकर्ता, अपनी स्क्रीन को शेयर, कास्ट या रिकॉर्ड किए जाने से रोकने के लिए, चिप पर टैप कर सकते हैं. साथ ही, डिवाइस की स्क्रीन लॉक होने पर, स्क्रीन प्रोजेक्शन अपने-आप बंद हो जाता है.

स्क्रीन शेयर करने, कास्ट करने, और रिकॉर्ड करने के लिए स्टेटस बार चिप.

देखें कि आपके ऐप्लिकेशन पर इसका असर पड़ा है या नहीं

डिफ़ॉल्ट रूप से, आपके ऐप्लिकेशन में स्टेटस बार चिप शामिल होता है. साथ ही, लॉक स्क्रीन चालू होने पर, स्क्रीन प्रोजेक्शन अपने-आप निलंबित हो जाता है.

इस्तेमाल के इन उदाहरणों के लिए, अपने ऐप्लिकेशन की जांच करने के तरीके के बारे में ज़्यादा जानने के लिए, स्टेटस बार के चिप और अपने-आप बंद होने की सुविधा लेख पढ़ें.

बैकग्राउंड में नेटवर्क ऐक्सेस करने से जुड़ी पाबंदियां

Android 15 में, ऐसे ऐप्लिकेशन को अपवाद मिलता है जो मान्य प्रोसेस के लाइफ़साइकल के बाहर नेटवर्क अनुरोध शुरू करते हैं. आम तौर पर, एक UnknownHostException या सॉकेट से जुड़ा कोई अन्य IOException. मान्य लाइफ़साइकल के बाहर होने वाले नेटवर्क अनुरोध, आम तौर पर तब होते हैं, जब ऐप्लिकेशन बंद होने के बाद भी, अनजाने में नेटवर्क अनुरोध जारी रहता है.

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

Deprecations

हर रिलीज़ के साथ, Android के कुछ एपीआई पुराने हो सकते हैं या डेवलपर को बेहतर अनुभव देने या नए प्लैटफ़ॉर्म की सुविधाओं के साथ काम करने के लिए, उन्हें फिर से तैयार करना पड़ सकता है. ऐसे मामलों में, हम पुराने एपीआई को आधिकारिक तौर पर बंद कर देते हैं. साथ ही, डेवलपर को अन्य एपीआई इस्तेमाल करने का सुझाव देते हैं.

बंद करने का मतलब है कि हमने एपीआई के लिए आधिकारिक सहायता बंद कर दी है. हालांकि, डेवलपर के लिए ये एपीआई उपलब्ध रहेंगे. Android के इस वर्शन में बंद किए गए कुछ एपीआई के बारे में ज़्यादा जानने के लिए, एपीआई बंद होने के बारे में जानकारी देने वाला पेज देखें.