نظرة عامة على الميزات وواجهات برمجة التطبيقات

يقدّم Android 14 ميزات وواجهات برمجة تطبيقات رائعة للمطوّرين. لمعرفة المزيد عن ميزات تطبيقاتك وبدء استخدام واجهات برمجة التطبيقات ذات الصلة،

للحصول على قائمة مفصّلة بواجهات برمجة التطبيقات التي تمت إضافتها وتعديلها وإزالتها، اطّلِع على تقرير الاختلافات في واجهة برمجة التطبيقات. للحصول على تفاصيل حول واجهات برمجة التطبيقات المُضافة، انتقِل إلى مرجع واجهة برمجة تطبيقات Android. بالنسبة إلى الإصدار 14 من نظام التشغيل Android، ابحث عن واجهات برمجة التطبيقات التي تمت إضافتها في المستوى 34. لمعرفة المجالات التي قد تؤثر فيها تغييرات النظام الأساسي في تطبيقاتك، يمكنك الاطّلاع على التغييرات في السلوك في Android 14 بالنسبة إلى التطبيقات التي تستهدف Android 14 وجميع التطبيقات.

التوافق مع أسواق عالمية

إعدادات اللغة المخصّصة حسب التطبيقات

يشمل نظام Android 14 ميزات كل لغة التي تم تقديمها في Android 13 (المستوى 33 لواجهة برمجة التطبيقات) مع هذه الإمكانات الإضافية:

  • إنشاء localeConfig لتطبيق تلقائيًا: بدءًا من إصدار Android Studio Giraffe Canary 7 والإصدار 8.1.0-alpha07 من Android، يمكنك ضبط تطبيقك للتوافق مع الإعدادات المفضّلة للغة حسب التطبيق تلقائيًا. استنادًا إلى موارد مشروعك، ينشئ المكوّن الإضافي لنظام Gradle المتوافق مع Android ملف LocaleConfig ويضيف مرجعًا إليه في ملف البيان النهائي، وبذلك لن يكون عليك إنشاء الملف أو تعديله يدويًا. يستخدم AGP الموارد في مجلدات res لوحدات تطبيقك وأيّ تبعيات لوحدات المكتبة لتحديد اللغات التي يجب تضمينها في ملف LocaleConfig.

  • تعديلات ديناميكية لتطبيق localeConfig: استخدِم طريقتَي setOverrideLocaleConfig() وgetOverrideLocaleConfig() في LocaleManager لتعديل قائمة اللغات المتوافقة في تطبيقك ديناميكيًا في إعدادات نظام الجهاز. يمكنك الاستفادة من هذه المرونة لتخصيص قائمة اللغات المتاحة لكل منطقة، أو إجراء تجارب أ/ب، أو تقديم قائمة معدّلة باللغات إذا كان تطبيقك يستخدم عمليات الدفع من جهة الخادم للأقلمة.

  • مستوى ظهور لغة التطبيق لأدوات تحرير أسلوب الإدخال (IMEs): يمكن لأدوات تحرير أسلوب الإدخال استخدام طريقة getApplicationLocales() للتحقق من لغة التطبيق الحالي ومطابقة لغة أداة IME لتلك اللغة.

واجهة برمجة تطبيقات التدفّق النحوي

يتحدّث 3 مليار شخص بلغات مختلفة، وهي لغات تعبّر فيها الفئات النحوية، مثل الأسماء والأفعال والصفات وأحرف الجر، حسب جنس الأشخاص والأشياء التي تتحدث عنها أو تتحدث عنها. في العادة، يستخدم العديد من اللغات المتفاوتة الجنس المذكر كجنس تلقائي أو عام.

إنّ مخاطبة المستخدمين الذين ينتمون إلى نحو خاطئ، مثل مخاطبة النساء بقواعد نحوية مذكّرة، يمكن أن تؤثّر سلبًا في أدائهم وموقفهن. في المقابل، فإن واجهة المستخدم ذات اللغة التي تعكس جنس المستخدم النحوي بشكل صحيح يمكن أن تحسن تفاعل المستخدم وتوفر تجربة مستخدم أكثر تخصيصًا وطبيعية.

لمساعدتك في إنشاء واجهة مستخدم تركِّز على المستخدم في اللغات التي تراعي نوع الجنس، يقدِّم Android 14 واجهة برمجة التطبيقات النحوية التي تتيح لك إضافة دعم للنوع النحوي بدون إعادة تنظيم تطبيقك.

الإعدادات المفضّلة للمنطقة

Regional preferences enable users to personalize temperature units, the first day of the week, and numbering systems. A European living in the United States might prefer temperature units to be in Celsius rather than Fahrenheit and for apps to treat Monday as the beginning of the week instead of the US default of Sunday.

New Android Settings menus for these preferences provide users with a discoverable and centralized location to change app preferences. These preferences also persist through backup and restore. Several APIs and intents—such as getTemperatureUnit and getFirstDayOfWeek— grant your app read access to user preferences, so your app can adjust how it displays information. You can also register a BroadcastReceiver on ACTION_LOCALE_CHANGED to handle locale configuration changes when regional preferences change.

To find these settings, open the Settings app and navigate to System > Languages & input > Regional preferences.

Regional preferences screen in Android system settings.
Temperature options for regional preferences in Android system settings.

تسهيل الاستخدام

تكبير الخط غير الخطي إلى 200%

Starting in Android 14, the system supports font scaling up to 200%, providing low-vision users with additional accessibility options that align with Web Content Accessibility Guidelines (WCAG).

To prevent large text elements on screen from scaling too large, the system applies a nonlinear scaling curve. This scaling strategy means that large text doesn't scale at the same rate as smaller text. Nonlinear font scaling helps preserve the proportional hierarchy between elements of different sizes while mitigating issues with linear text scaling at high degrees (such as text being cut off or text that becomes harder to read due to an extremely large display sizes).

Test your app with nonlinear font scaling

Enable the maximum font size in a device's accessibility settings to test your app.

If you already use scaled pixels (sp) units to define text sizing, then these additional options and scaling improvements are applied automatically to the text in your app. However, you should still perform UI testing with the maximum font size enabled (200%) to ensure that your app applies the font sizes correctly and can accommodate larger font sizes without impacting usability.

To enable 200% font size, follow these steps:

  1. Open the Settings app and navigate to Accessibility > Display size and text.
  2. For the Font size option, tap the plus (+) icon until the maximum font size setting is enabled, as shown in the image that accompanies this section.

Use scaled pixel (sp) units for text-sizes

Remember to always specify text sizes in sp units. When your app uses sp units, Android can apply the user's preferred text size and scale it appropriately.

Don't use sp units for padding or define view heights assuming implicit padding: with nonlinear font scaling sp dimensions might not be proportional, so 4sp + 20sp might not equal 24sp.

Convert scaled pixel (sp) units

Use TypedValue.applyDimension() to convert from sp units to pixels, and use TypedValue.deriveDimension() to convert pixels to sp. These methods apply the appropriate nonlinear scaling curve automatically.

Avoid hardcoding equations using Configuration.fontScale or DisplayMetrics.scaledDensity. Because font scaling is nonlinear, the scaledDensity field is no longer accurate. The fontScale field should be used for informational purposes only because fonts are no longer scaled with a single scalar value.

Use sp units for lineHeight

Always define android:lineHeight using sp units instead of dp, so the line height scales along with your text. Otherwise, if your text is sp but your lineHeight is in dp or px, it doesn't scale and looks cramped. TextView automatically corrects the lineHeight so that your intended proportions are preserved, but only if both textSize and lineHeight are defined in sp units.

الكاميرا والوسائط

دقة HDR فائقة للصور

An illustration of Standard Dynamic Range (SDR) versus High Dynamic Range (HDR) image quality.

Android 14 adds support for High Dynamic Range (HDR) images that retain more of the information from the sensor when taking a photo, which enables vibrant colors and greater contrast. Android uses the Ultra HDR format, which is fully backward compatible with JPEG images, allowing apps to seamlessly interoperate with HDR images, displaying them in Standard Dynamic Range (SDR) as needed.

Rendering these images in the UI in HDR is done automatically by the framework when your app opts in to using HDR UI for its Activity Window, either through a manifest entry or at runtime by calling Window.setColorMode(). You can also capture compressed Ultra HDR still images on supported devices. With more colors recovered from the sensor, editing in post can be more flexible. The Gainmap associated with Ultra HDR images can be used to render them using OpenGL or Vulkan.

ميزات التكبير أو التصغير والتركيز وعرض المشاركات والمزيد في إضافات الكاميرا

يعمل Android 14 على ترقية إضافات الكاميرا وتحسينها، ما يسمح للتطبيقات بالتعامل مع أوقات معالجة أطول، ما يتيح الحصول على صور محسَّنة باستخدام خوارزميات تستهلك قدرًا كبيرًا من الحوسبة، مثل التصوير في إضاءة منخفضة على الأجهزة المتوافقة. توفّر هذه الميزات للمستخدمين تجربة أكثر قوة عند استخدام إمكانات الإضافات في الكاميرا. تشمل الأمثلة على هذه التحسينات ما يلي:

  • إنّ التقدير الديناميكي لوقت استجابة المعالجة لا يزال يوفّر دقة أكبر، ويوفّر تقديرات أكثر دقة لوقت الاستجابة استنادًا إلى المشهد الحالي والظروف البيئية. يمكنك استدعاء CameraExtensionSession.getRealtimeStillCaptureLatency() للحصول على عنصر StillCaptureLatency يتضمن طريقتَين لتقدير وقت الاستجابة. تعرض الطريقة getCaptureLatency() وقت الاستجابة المقدّر بين onCaptureStarted وonCaptureProcessStarted()، وتعرض طريقة getProcessingLatency() وقت الاستجابة المقدَّر بين onCaptureProcessStarted() والإطار النهائي الذي تمت معالجته والمتاح.
  • إتاحة الحصول على عمليات معاودة الاتصال بشأن مستوى التقدّم حتى تتمكّن التطبيقات من عرض مستوى التقدّم الحالي في عمليات المعالجة التي لا تزال قيد المعالجة والتي لا تزال تُعرض لفترة طويلة يمكنك التحقّق مما إذا كانت هذه الميزة متاحة مع CameraExtensionCharacteristics.isCaptureProcessProgressAvailable، وفي حال توفّرها، يمكنك تنفيذ معاودة الاتصال onCaptureProcessProgressed() التي يتم تمرير مستوى التقدّم (من 0 إلى 100) كمعلّمة.
  • البيانات الوصفية الخاصة بالإضافة، مثل CaptureRequest.EXTENSION_STRENGTH لطلب مقدار تأثير الإضافة، مثل مقدار تمويه الخلفية باستخدام EXTENSION_BOKEH

  • ميزة Postview لالتقاط الصور الثابتة في إضافات الكاميرا، والتي توفِّر صورة أقل معالجة بسرعة أكبر مقارنةً بالصورة النهائية في حال زيادة وقت استجابة المعالجة، يمكن تقديم صورة ما بعد المشاهدة كعنصر نائب لتحسين تجربة المستخدم وإيقافها لاحقًا للصورة النهائية. يمكنك التحقق مما إذا كانت هذه الميزة متوفرة في CameraExtensionCharacteristics.isPostviewAvailable. يمكنك بعد ذلك تمرير OutputConfiguration إلى ExtensionSessionConfiguration.setPostviewOutputConfiguration.

  • دعم SurfaceView، مما يسمح بمسار عرض معاينة أكثر تحسينًا وكفاءة.

  • إتاحة النقر للتركيز والتكبير/التصغير أثناء استخدام الإضافات

تكبير/تصغير ضمن المستشعر

When REQUEST_AVAILABLE_CAPABILITIES_STREAM_USE_CASE in CameraCharacteristics contains SCALER_AVAILABLE_STREAM_USE_CASES_CROPPED_RAW, your app can use advanced sensor capabilities to give a cropped RAW stream the same pixels as the full field of view by using a CaptureRequest with a RAW target that has stream use case set to CameraMetadata.SCALER_AVAILABLE_STREAM_USE_CASES_CROPPED_RAW. By implementing the request override controls, the updated camera gives users zoom control even before other camera controls are ready.

فقدان الصوت عبر USB

أصبح نظام التشغيل Android 14 متوافقًا مع تنسيقات الصوت بدون فقدان البيانات لتجارب محبي الموسيقى عبر سماعات الرأس السلكية USB. يمكنك طلب البحث عن سمات أداة المزج المفضّلة في جهاز USB، وتسجيل أداة معالجة التغييرات في سمات المزج المفضّلة، وإعداد سمات أداة المزج باستخدام الفئة AudioMixerAttributes. وتمثل هذه الفئة التنسيق، مثل قناع القناة ومعدّل العينة وسلوك أداة مزج الصوت. وتتيح هذه الفئة إرسال المحتوى الصوتي مباشرةً بدون خلط أو تعديل في الحجم أو تأثيرات للمعالجة.

أدوات وإنتاجية المطوّرين

مدير بيانات الاعتماد

Android 14 adds Credential Manager as a platform API, with additional support back to Android 4.4 (API level 19) devices through a Jetpack Library using Google Play services. Credential Manager aims to make sign-in easier for users with APIs that retrieve and store credentials with user-configured credential providers. Credential Manager supports multiple sign-in methods, including username and password, passkeys, and federated sign-in solutions (such as Sign-in with Google) in a single API.

Passkeys provide many advantages. For example, passkeys are built on industry standards, can work across different operating systems and browser ecosystems, and can be used with both websites and apps.

For more information, see the Credential Manager and passkeys documentation and the blogpost about Credential Manager and passkeys.

Health Connect

Health Connect is an on-device repository for user health and fitness data. It allows users to share data between their favorite apps, with a single place to control what data they want to share with these apps.

On devices running Android versions prior to Android 14, Health Connect is available to download as an app on the Google Play store. Starting with Android 14, Health Connect is part of the platform and receives updates through Google Play system updates without requiring a separate download. With this, Health Connect can be updated frequently, and your apps can rely on Health Connect being available on devices running Android 14 or higher. Users can access Health Connect from the Settings in their device, with privacy controls integrated into the system settings.

Users can get started using Health Connect without a separate app download on devices running Android 14 or higher.
Users can control which apps have access to their health and fitness data through system settings.

Health Connect includes several new features in Android 14, such as exercise routes, allowing users to share a route of their workout which can be visualized on a map. A route is defined as a list of locations saved within a window of time, and your app can insert routes into exercise sessions, tying them together. To ensure that users have complete control over this sensitive data, users must allow sharing individual routes with other apps.

For more information, see the Health Connection documentation and the blogpost on What's new in Android Health.

تحديثات OpenJDK 17

يواصل Android 14 العمل على تحديث مكتبات Android الأساسية للتوافق مع الميزات الواردة في أحدث إصدارات OpenJDK LTS، بما في ذلك تحديثات المكتبة وإتاحة اللغة في Java 17 لمطوّري التطبيقات والأنظمة الأساسية.

يتم تضمين الميزات والتحسينات التالية:

  • تم تحديث حوالي 300 صف java.base لتصبح متوافقة مع Java 17.
  • القوالب النصية، التي تضيف القيم الحرفية للسلاسل المتعددة الأسطر إلى لغة برمجة Java.
  • مطابقة النمط لـ exampleof، والتي تسمح بالتعامل مع الكائن على أنه له نوع معين في instanceof بدون أي متغيّرات إضافية.
  • الفئات المحمية: تسمح لك بتقييد الفئات والواجهات التي يمكن توسيعها أو تنفيذها.

بفضل تحديثات نظام Google Play (Project Mainline)، تم تفعيل أكثر من 600 مليون جهاز لتلقّي آخر تحديثات وقت تشغيل Android (ART) التي تتضمّن هذه التغييرات. يشكّل ذلك جزءًا من التزامنا بمنح التطبيقات بيئة أكثر اتساقًا وأمانًا على جميع الأجهزة، فضلاً عن تقديم ميزات وإمكانات جديدة للمستخدمين بشكل مستقل عن إصدارات النظام الأساسي.

إنّ Java وOpenJDK هما علامتان تجاريتان أو علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.

تحسينات لمتاجر التطبيقات

يقدّم Android 14 العديد من واجهات برمجة تطبيقات PackageInstaller التي تسمح لمتاجر التطبيقات بتحسين تجربة المستخدم.

طلب الموافقة على التثبيت قبل التنزيل

قد يتطلب تثبيت أحد التطبيقات أو تحديثه موافقة المستخدم. على سبيل المثال، عندما يحاول مثبِّت يستخدم إذن REQUEST_INSTALL_PACKAGES تثبيت تطبيق جديد. في إصدارات Android السابقة، لا يمكن لمتاجر التطبيقات طلب موافقة المستخدم إلا بعد كتابة ملفات APK في جلسة التثبيت وتكون الجلسة الملزَمة.

بدءًا من نظام التشغيل Android 14، تتيح الطريقة requestUserPreapproval() للمثبِّتين طلب موافقة المستخدم قبل إتمام جلسة التثبيت. يتيح هذا التحسين لمتجر التطبيقات تأجيل تنزيل أي حِزم APK إلى أن يوافق المستخدم على عملية التثبيت. بالإضافة إلى ذلك، بعد موافقة المستخدم على تثبيت التطبيق، يمكن لمتجر التطبيقات تنزيل التطبيق وتثبيته في الخلفية بدون مقاطعة المستخدم.

المطالبة بالمسؤولية عن التحديثات المستقبلية

تسمح طريقة setRequestUpdateOwnership() للمثبت بالإشارة إلى النظام إلى أنه ينوي أن يكون مسؤولًا عن التحديثات المستقبلية للتطبيق الذي يثبّته. وتتيح هذه الميزة فرض تحديث الملكية، ما يعني أنّه يُسمح فقط لمالك التحديث بتثبيت التحديثات التلقائية للتطبيق. ويساعد تحديث فرض الملكية على ضمان تلقّي المستخدمين للتحديثات من متجر التطبيقات المتوقّع فقط.

يجب أن يحصل أي مثبّت آخر، بما في ذلك مَن يستفيد من إذن INSTALL_PACKAGES، على موافقة صريحة من المستخدم لتثبيت التحديث. إذا قرر المستخدم متابعة تحديث من مصدر آخر، ستفقد ملكية التحديث.

تحديث التطبيقات في أوقات أقل إزعاجًا

تحتاج متاجر التطبيقات عادةً إلى تجنُّب تحديث تطبيق قيد الاستخدام، لأن ذلك يؤدي إلى إنهاء عمليات التطبيق قيد التشغيل، ما قد يؤدي إلى مقاطعة ما كان يفعله المستخدم.

بدءًا من نظام التشغيل Android 14، تمنح واجهة برمجة التطبيقات InstallConstraints API للمثبّتي التطبيق طريقة لضمان إجراء تحديثات التطبيقات في الوقت المناسب. على سبيل المثال، يمكن لمتجر التطبيقات استدعاء طريقة commitSessionAfterInstallConstraintsAreMet() للتأكّد من إجراء تحديث فقط عندما لا يتفاعل المستخدم مع التطبيق المعنيّ.

تثبيت التقسيمات الاختيارية بسلاسة

أما مع حِزم APK المجزّأة، فيمكن تقديم ميزات التطبيق في ملفات APK منفصلة، بدلاً من عرض ميزات التطبيق كحزمة APK متجانسة. وتسمح حِزم APK المقسَّمة لمتاجر التطبيقات بتحسين عرض مكونات التطبيق المختلفة. على سبيل المثال، قد يتم تحسين متاجر التطبيقات بناءً على خصائص الجهاز المستهدف. توفّر واجهة برمجة التطبيقات PackageInstaller إمكانية التقسيمات منذ إطلاقها في المستوى 22 من واجهة برمجة التطبيقات.

في نظام التشغيل Android 14، تسمح طريقة setDontKillApp() لأداة التثبيت بالإشارة إلى أنّه يجب عدم إيقاف عمليات التشغيل في التطبيق عند تثبيت أقسام جديدة. يمكن لمتاجر التطبيقات استخدام هذه الميزة لتثبيت ميزات جديدة للتطبيق بسلاسة أثناء استخدام المستخدم للتطبيق.

حِزم البيانات الوصفية للتطبيق

بدءًا من نظام التشغيل Android 14، تتيح لك أداة تثبيت حزمة Android تحديد البيانات الوصفية للتطبيقات، مثل ممارسات أمان البيانات، لتضمينها في صفحات متجر التطبيقات، مثل Google Play.

رصد الحالات التي يلتقط فيها المستخدمون لقطات شاشة للجهاز

لإنشاء تجربة موحّدة لرصد لقطات الشاشة، يوفّر Android 14 واجهة برمجة تطبيقات لرصد لقطات الشاشة تحافظ على الخصوصية. تتيح واجهة برمجة التطبيقات هذه للتطبيقات تسجيل عمليات معاودة الاتصال على أساس كل نشاط. يتم استدعاء عمليات معاودة الاتصال هذه ويتم إعلام المستخدم عندما يأخذ المستخدم لقطة شاشة عندما يكون هذا النشاط مرئيًا.

تجربة المستخدم

إجراءات مخصّصة في "قائمة مشاركة البيانات" وترتيب محسَّن

Android 14 updates the system sharesheet to support custom app actions and more informative preview results for users.

Add custom actions

With Android 14, your app can add custom actions to the system sharesheet it invokes.

Screenshot of custom actions on the sharesheet.

Improve ranking of Direct Share targets

Android 14 uses more signals from apps to determine the ranking of the direct share targets to provide more helpful results for the user. To provide the most useful signal for ranking, follow the guidance for improving rankings of your Direct Share targets. Communication apps can also report shortcut usage for outgoing and incoming messages.

Direct Share row in the sharesheet, as shown by 1

دعم الصور المتحركة المدمَجة والمخصَّصة لإظهار ميزة "الظهور التلقائي"

فيديو: رسوم متحركة توقّعية تظهر في الخلف

قدّم Android 13 صورة متحركة تنبؤية للعودة إلى المنزل الكامنة وراء خيار للمطوّرين. وعند استخدامه في تطبيق متوافق مع تفعيل خيار مطوّر البرامج، يؤدي التمرير سريعًا للخلف إلى عرض صورة متحركة تشير إلى أنّ إيماءة الرجوع تعمل على الخروج من التطبيق للعودة إلى الشاشة الرئيسية.

يتضمّن Android 14 تحسينات متعدّدة وإرشادات جديدة لميزة "الرجوع إلى الشاشة السابقة":

في إصدار المعاينة هذا الذي يوفِّره Android 14، لا تزال جميع ميزات "إيماءة إظهار شاشة الرجوع" متوفّرة بدون تدخّل خيار للمطوّرين. راجِع دليل المطوِّر حول نقل تطبيقك إلى الإعدادات السابقة التنبؤية، بالإضافة إلى دليل المطوِّر حول إنشاء عمليات نقل مخصَّصة داخل التطبيق.

عمليات الإلغاء حسب الشركة المصنّعة للجهاز ذي الشاشة الكبيرة

Per-app overrides enable device manufacturers to change the behavior of apps on large screen devices. For example, the FORCE_RESIZE_APP override instructs the system to resize the app to fit display dimensions (avoiding size compatibility mode) even if resizeableActivity="false" is set in the app manifest.

Overrides are intended to improve the user experience on large screens.

New manifest properties enable you to disable some device manufacturer overrides for your app.

عمليات إلغاء مستخدم الشاشة الكبيرة لكل تطبيق

تؤدي عمليات الإلغاء حسب التطبيقات إلى تغيير سلوك التطبيقات على الأجهزة ذات الشاشات الكبيرة. على سبيل المثال، عند إلغاء إعداد الشركة المصنّعة لجهاز OVERRIDE_MIN_ASPECT_RATIO_LARGE، يتم ضبط نسبة العرض إلى الارتفاع في التطبيق على 16:9 بغض النظر عن إعدادات التطبيق.

يتيح نظام Android 14 QPR1 للمستخدمين تطبيق عمليات الإلغاء لكل تطبيق من خلال قائمة إعدادات جديدة على الأجهزة ذات الشاشات الكبيرة.

مشاركة شاشة التطبيق

تتيح ميزة "مشاركة شاشة التطبيق" للمستخدمين مشاركة نافذة تطبيق بدلاً من شاشة الجهاز بأكملها أثناء تسجيل محتوى الشاشة.

عند استخدام ميزة "مشاركة شاشة التطبيق"، يتم استبعاد شريط الحالة وشريط التنقّل والإشعارات وغيرها من عناصر واجهة مستخدم النظام من العرض المشترك. لا تتم مشاركة سوى محتوى التطبيق المحدد.

تعمل ميزة "مشاركة شاشة التطبيقات" على تحسين الإنتاجية والخصوصية من خلال السماح للمستخدمين بتشغيل تطبيقات متعددة مع حصر مشاركة المحتوى بتطبيق واحد.

ميزة "الرد السريع" المستندة إلى نموذج لغوي كبير (LLM) في Gboard على هاتف Pixel 8 Pro

On Pixel 8 Pro devices with the December Feature Drop, developers can try out higher-quality smart replies in Gboard powered by on-device Large Language Models (LLMs) running on Google Tensor.

This feature is available as a limited preview for US English in WhatsApp, Line, and KakaoTalk. It requires using a Pixel 8 Pro device with Gboard as your keyboard.

To try it out, first enable the feature in Settings > Developer Options > AiCore Settings > Enable Aicore Persistent.

Next, open a conversation in a supported app to see LLM-powered Smart Reply in Gboard's suggestion strip in response to incoming messages.

Gboard utilizes on-device LLMs to provide higher-quality smart replies.

الرسومات

المسارات القابلة للاستعلام والدمج

واجهة برمجة التطبيقات Path في Android هي آلية فعّالة ومرنة لإنشاء الرسومات المتّجهة وعرضها، مع إمكانية رسم مسار أو تعبئته، وإنشاء مسار من القطاعات الخطية أو المنحنيات التربيعية أو التكعيبية، أو تنفيذ عمليات منطقية للحصول على أشكال أكثر تعقيدًا، أو تنفيذ جميع هذه الإجراءات في الوقت نفسه. يتمثل أحد القيود في إمكانية اكتشاف ما هو موجود بالفعل في كائن Path (مسار)، حيث لا تكون العناصر الداخلية للكائن معتمة للمُتصِلين بعد الإنشاء.

لإنشاء Path، يمكنك استدعاء طرق مثل moveTo() وlineTo() وcubicTo() لإضافة أقسام المسار. ولكن لم تكن هناك طريقة تسأل عن ماهية المقاطع في هذا المسار، لذا يجب عليك الاحتفاظ بهذه المعلومات في وقت الإنشاء.

بدءًا من نظام التشغيل Android 14، يمكنك الاستعلام عن المسارات لمعرفة مضمونها. أولاً، يجب الحصول على عنصر PathIterator باستخدام Path.getPathIterator API:

Kotlin

val path = Path().apply {
    moveTo(1.0f, 1.0f)
    lineTo(2.0f, 2.0f)
    close()
}
val pathIterator = path.pathIterator

Java

Path path = new Path();
path.moveTo(1.0F, 1.0F);
path.lineTo(2.0F, 2.0F);
path.close();
PathIterator pathIterator = path.getPathIterator();

بعد ذلك، يمكنك استدعاء PathIterator للتكرار عبر الشرائح واحدة تلو الأخرى، واسترداد كل البيانات اللازمة لكل شريحة. يستخدم هذا المثال كائنات PathIterator.Segment التي تحزم البيانات لك:

Kotlin

for (segment in pathIterator) {
    println("segment: ${segment.verb}, ${segment.points}")
}

Java

while (pathIterator.hasNext()) {
    PathIterator.Segment segment = pathIterator.next();
    Log.i(LOG_TAG, "segment: " + segment.getVerb() + ", " + segment.getPoints());
}

لدى PathIterator أيضًا إصدار غير مخصّص من next() يمكنك من خلاله تمرير مخزن احتياطي للاحتفاظ ببيانات النقاط.

إحدى حالات الاستخدام المهمة للاستعلام عن بيانات Path هي الاستيفاء. على سبيل المثال، قد ترغب في تحريك (أو تحويل) بين مسارين مختلفين. ولتبسيط حالة الاستخدام هذه بشكل أكبر، يتضمّن Android 14 أيضًا طريقة interpolate() في Path. على افتراض أن المسارين لهما نفس البنية الداخلية، تقوم طريقة interpolate() بإنشاء Path جديد بهذه النتيجة المضافة. يعرض هذا المثال مسارًا يكون شكله في المنتصف (استيفاء خطيًا لرقم 5.) بين path وotherPath:

Kotlin

val interpolatedResult = Path()
if (path.isInterpolatable(otherPath)) {
    path.interpolate(otherPath, .5f, interpolatedResult)
}

Java

Path interpolatedResult = new Path();
if (path.isInterpolatable(otherPath)) {
    path.interpolate(otherPath, 0.5F, interpolatedResult);
}

توفّر مكتبة مسار الرسومات في Jetpack واجهات برمجة تطبيقات مشابهة للإصدارات السابقة من نظام التشغيل Android أيضًا.

شبكات مخصّصة مع أدوات تظليل الأجزاء برأسي وأجزاء

Android has long supported drawing triangle meshes with custom shading, but the input mesh format has been limited to a few predefined attribute combinations. Android 14 adds support for custom meshes, which can be defined as triangles or triangle strips, and can, optionally, be indexed. These meshes are specified with custom attributes, vertex strides, varying, and vertex and fragment shaders written in AGSL.

The vertex shader defines the varyings, such as position and color, while the fragment shader can optionally define the color for the pixel, typically by using the varyings created by the vertex shader. If color is provided by the fragment shader, it is then blended with the current Paint color using the blend mode selected when drawing the mesh. Uniforms can be passed into the fragment and vertex shaders for additional flexibility.

عارض المخزن المؤقت للأجهزة للوحة الرسم

للمساعدة في استخدام واجهة برمجة التطبيقات Canvas في نظام التشغيل Android للرسم باستخدام تسريع الأجهزة في HardwareBuffer، يطرح Android 14 HardwareBufferRenderer. تفيدك واجهة برمجة التطبيقات هذه بشكل خاص عندما تتضمّن حالة الاستخدام الاتصال بمكوِّن النظام من خلال SurfaceControl للرسم في وقت استجابة سريع.