Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed #17989: touch stops responding on android devices. #18165

Merged
merged 1 commit into from
Aug 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 0 additions & 3 deletions cocos/base/CCEventType.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,5 @@
// This message is posted in cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxRenderer.cpp and cocos\platform\wp8-xaml\cpp\Cocos2dRenderer.cpp.
#define EVENT_COME_TO_BACKGROUND "event_come_to_background"

// The name of an event which indicates there will be a file being read.
#define EVENT_BEFORE_READ_FILE "event_before_read_file"

/// @endcond
#endif // __CCEVENT_TYPE_H__
6 changes: 2 additions & 4 deletions cocos/platform/android/CCFileUtils-android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,10 @@ THE SOFTWARE.
#include "platform/CCCommon.h"
#include "platform/android/jni/JniHelper.h"
#include "platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h"
#include "platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxEngineDataManager.h"
#include "android/asset_manager.h"
#include "android/asset_manager_jni.h"
#include "base/ZipUtils.h"
#include "base/CCDirector.h"
#include "base/CCEventDispatcher.h"
#include "base/CCEventType.h"

#include <stdlib.h>
#include <sys/stat.h>
Expand Down Expand Up @@ -283,7 +281,7 @@ long FileUtilsAndroid::getFileSize(const std::string& filepath)

FileUtils::Status FileUtilsAndroid::getContents(const std::string& filename, ResizableBuffer* buffer)
{
Director::getInstance()->getEventDispatcher()->dispatchCustomEvent(EVENT_BEFORE_READ_FILE);
EngineDataManager::onBeforeReadFile();

static const std::string apkprefix("assets/");
if (filename.empty())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ void EngineDataManager::onBeforeSetNextScene(EventCustom* event)
_isReplaceScene = true;
}

void EngineDataManager::onBeforeReadFile(EventCustom* event)
void EngineDataManager::onBeforeReadFile()
{
_isReadFile = true;
}
Expand Down Expand Up @@ -1376,7 +1376,6 @@ void EngineDataManager::init()
dispatcher->addCustomEventListener(Director::EVENT_BEFORE_SET_NEXT_SCENE, std::bind(onBeforeSetNextScene, std::placeholders::_1));
dispatcher->addCustomEventListener(EVENT_COME_TO_FOREGROUND, std::bind(onEnterForeground, std::placeholders::_1));
dispatcher->addCustomEventListener(EVENT_COME_TO_BACKGROUND, std::bind(onEnterBackground, std::placeholders::_1));
dispatcher->addCustomEventListener(EVENT_BEFORE_READ_FILE, std::bind(onBeforeReadFile, std::placeholders::_1));

notifyGameStatus(GameStatus::LAUNCH_BEGIN, 5, -1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class EngineDataManager

static void notifyGameStatus(GameStatus type, int cpuLevel, int gpuLevel);
static void setAnimationInterval(float interval, SetIntervalReason reason);
// Used in FileUtilsAndroid::getContents
static void onBeforeReadFile();

private:
static void notifyContinuousFrameLost(int frameLostCycle, int continueFrameLostThreshold, int times);
Expand All @@ -68,7 +70,6 @@ class EngineDataManager
static void onAfterDrawScene(EventCustom* event);
static void onEnterForeground(EventCustom* event);
static void onEnterBackground(EventCustom* event);
static void onBeforeReadFile(EventCustom* event);

static int getTotalParticleCount();

Expand Down