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

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

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

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

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

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

The intention of the package FLAG_STOPPED state (which users can engage in AOSP builds by long-pressing an app icon and selecting "Force Stop") has always been to keep apps in this state until the user explicitly removes the app from this state by directly launching the app or indirectly interacting with the app (through the sharesheet or a widget, selecting the app as live wallpaper, etc.). In Android 15, we've updated the behavior of the system to be aligned with this intended behavior. Apps should only be removed from the stopped state through direct or indirect user action.

To support the intended behavior, in addition to the existing restrictions, the system also cancels all pending intents when the app enters the stopped state on a device running Android 15. When the user's actions remove the app from the stopped state, the ACTION_BOOT_COMPLETED broadcast is delivered to the app providing an opportunity to re-register any pending intents.

You can call the new ApplicationStartInfo.wasForceStopped() method to confirm whether the app was put into the stopped state.

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 मिलीसेकंड) की बढ़ोतरी हुई

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

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

If your app uses any native code, then you should rebuild your app with support for 16 KB devices. If you are unsure if your app uses native code, you can use the APK Analyzer to identify whether any native code is present and then check the alignment of ELF segments for any shared libraries that you find. Android Studio also provides features that help you to automatically detect alignment issues.

If your app only uses code written in the Java programming language or in Kotlin, including all libraries or SDKs, then your app already supports 16 KB devices. Nevertheless, we recommend that you test your app in a 16 KB environment to verify that there are no unexpected regressions in app behavior.

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

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.

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

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.

SDK टूल के टारगेट वर्शन का कम से कम लेवल 23 से बढ़ाकर 24 किया गया

Android 15, Android 15 के साथ Android 14 में किए गए बदलावों को ध्यान में रखते हुए बनाया गया है. सुरक्षा को बेहतर किया है. Android 15 में, 24 से कम targetSdkVersion वाले ऐप्लिकेशन इंस्टॉल नहीं किए जा सकते. आधुनिक एपीआई लेवल को पूरा करने के लिए ऐप्लिकेशन की ज़रूरत, बेहतर सुरक्षा और निजता.

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

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

Android 15 पर अपग्रेड करने वाले डिवाइसों पर, targetSdkVersion 24 से कम वाले सभी ऐप्लिकेशन इंस्टॉल रहेंगे.

अगर आपको पुराने एपीआई लेवल को टारगेट करने वाले किसी ऐप्लिकेशन की जांच करनी है, तो यहां दिए गए ADB का इस्तेमाल करें आदेश:

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.

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

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

जब उपयोगकर्ता अगली बार ऐप्लिकेशन लॉन्च करता है, तो सिस्टम उन विजेट को फिर से चालू कर देता है.

ज़्यादा जानकारी के लिए, पैकेज के बंद होने की स्थिति में हुए बदलाव लेख पढ़ें.

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

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

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

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

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

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

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

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

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

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

Deprecations

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

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