mirror of
https://github.com/openharmony/ability_ability_runtime.git
synced 2026-08-24 22:21:36 -04:00
Update deviceType acquisition method.
Signed-off-by: dy_study <dingyao5@huawei.com> Change-Id: I0cc462ed77b63e4c1034472a494aa236da6885fd
This commit is contained in:
@@ -300,8 +300,7 @@ bool AbilityManagerService::Init()
|
||||
}
|
||||
#endif
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
DelayedSingleton<SystemDialogScheduler>::GetInstance()->SetDeviceType(
|
||||
AmsConfigurationParameter::GetInstance().GetDeviceType());
|
||||
DelayedSingleton<SystemDialogScheduler>::GetInstance()->SetDeviceType(OHOS::system::GetDeviceType());
|
||||
implicitStartProcessor_ = std::make_shared<ImplicitStartProcessor>();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "event_report.h"
|
||||
#include "hilog_wrapper.h"
|
||||
#include "in_process_call_wrapper.h"
|
||||
#include "parameters.h"
|
||||
#include "want.h"
|
||||
|
||||
namespace OHOS {
|
||||
@@ -69,7 +70,8 @@ int ImplicitStartProcessor::ImplicitStartAbility(AbilityRequest &request, int32_
|
||||
CHECK_POINTER_AND_RETURN(sysDialogScheduler, ERR_INVALID_VALUE);
|
||||
|
||||
std::vector<DialogAppInfo> dialogAppInfos;
|
||||
auto deviceType = sysDialogScheduler->GetDeviceType();
|
||||
auto deviceType = OHOS::system::GetDeviceType();
|
||||
HILOG_DEBUG("deviceType is %{public}s", deviceType.c_str());
|
||||
auto ret = GenerateAbilityRequestByAction(userId, request, dialogAppInfos, deviceType, false);
|
||||
if (ret != ERR_OK) {
|
||||
HILOG_ERROR("generate ability request by action failed.");
|
||||
|
||||
+1
-2
@@ -13,7 +13,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import deviceInfo from '@ohos.deviceInfo';
|
||||
import display from '@ohos.display';
|
||||
import extension from '@ohos.app.ability.ServiceExtensionAbility';
|
||||
import window from '@ohos.window';
|
||||
@@ -50,7 +49,7 @@ export default class JumpInterceptorServiceExtAbility extends extension {
|
||||
win.destroy();
|
||||
winNum--;
|
||||
}
|
||||
if (deviceInfo.deviceType === 'phone') {
|
||||
if (globalThis.params.deviceType === 'phone' || globalThis.params.deviceType === 'default') {
|
||||
this.createWindow('JumpInterceptorDialog' + startId, window.WindowType.TYPE_SYSTEM_ALERT, navigationBarRect);
|
||||
} else {
|
||||
this.createWindow('JumpInterceptorDialog' + startId, window.WindowType.TYPE_FLOAT, navigationBarRect);
|
||||
|
||||
+3
-4
@@ -16,7 +16,6 @@
|
||||
import extension from '@ohos.app.ability.ServiceExtensionAbility';
|
||||
import window from '@ohos.window';
|
||||
import display from '@ohos.display';
|
||||
import deviceInfo from '@ohos.deviceInfo';
|
||||
import defaultAppManager from '@ohos.bundle.defaultAppManager';
|
||||
import bundleManager from '@ohos.bundle.bundleManager';
|
||||
|
||||
@@ -104,7 +103,7 @@ export default class SelectorServiceExtensionAbility extends extension {
|
||||
globalThis.modelFlag = Boolean(globalThis.params.modelFlag);
|
||||
globalThis.action = Boolean(globalThis.params.action);
|
||||
}
|
||||
if (globalThis.params.deviceType === 'phone') {
|
||||
if (globalThis.params.deviceType === 'phone' || globalThis.params.deviceType === 'default') {
|
||||
await this.getPhoneShowHapList();
|
||||
} else {
|
||||
await this.getPcShowHapList();
|
||||
@@ -121,7 +120,7 @@ export default class SelectorServiceExtensionAbility extends extension {
|
||||
win.destroy();
|
||||
winNum--;
|
||||
}
|
||||
if (deviceInfo.deviceType === 'phone') {
|
||||
if (globalThis.params.deviceType === 'phone' || globalThis.params.deviceType === 'default') {
|
||||
this.createWindow('SelectorDialog' + startId, window.WindowType.TYPE_SYSTEM_ALERT, navigationBarRect);
|
||||
} else {
|
||||
console.debug(TAG, 'onRequest, params: ' + JSON.stringify(globalThis.params));
|
||||
@@ -148,7 +147,7 @@ export default class SelectorServiceExtensionAbility extends extension {
|
||||
});
|
||||
await win.moveTo(rect.left, rect.top);
|
||||
await win.resetSize(rect.width, rect.height);
|
||||
if (globalThis.params.deviceType == 'phone') {
|
||||
if (globalThis.params.deviceType === 'phone' || globalThis.params.deviceType === 'default') {
|
||||
await win.loadContent('pages/selectorPhoneDialog');
|
||||
} else {
|
||||
await win.loadContent('pages/selectorPcDialog');
|
||||
|
||||
+1
-2
@@ -16,7 +16,6 @@
|
||||
import extension from '@ohos.app.ability.ServiceExtensionAbility';
|
||||
import window from '@ohos.window';
|
||||
import display from '@ohos.display';
|
||||
import deviceInfo from '@ohos.deviceInfo';
|
||||
|
||||
const TAG = 'TipsDialog_Service';
|
||||
|
||||
@@ -47,7 +46,7 @@ export default class TipsServiceExtensionAbility extends extension {
|
||||
win.destroy();
|
||||
winNum--;
|
||||
}
|
||||
if (deviceInfo.deviceType === 'phone') {
|
||||
if (globalThis.params.deviceType === 'phone' || globalThis.params.deviceType === 'default') {
|
||||
this.createWindow('TipsDialog' + startId, window.WindowType.TYPE_SYSTEM_ALERT, navigationBarRect);
|
||||
} else {
|
||||
this.createWindow('TipsDialog' + startId, window.WindowType.TYPE_DIALOG, navigationBarRect);
|
||||
|
||||
Reference in New Issue
Block a user